Faster digital write speed

Hello everyone,

I need some help to make the digital outputs a bit faster. I need to use T40 to generate a clock somewhere between 10-25 MHz on pin 20 and 21.
I tried to increase the drive strength, as well as play with IOMUXC_PAD_SRE and IOMUXC_PAD_SPEED. (I modified Paul's pinModeExt code). Changing OUTPUT_1 to OUTPUT_7 make the raise time change, but I don't see any effect on IOMUXC_PAD_SRE and IOMUXC_PAD_SPEED. With OUTPUT_7, I see the raise time is about 40ns on Pin 21. Is this the fastest I can get?
I'm trying to make my own I2S code to drive Audio Codecs, currently the clock looks very slow and will definitly loose timing if I try to drive it faster.
I have attahced a photo from my 200Mhz scope. The scope is connected directly to the pin of a unsoldered T40. Nothing is connected to it.

Thank you!

20250403_192811.jpg


pinModeExt(20, OUTPUT_7);
pinModeExt(21, OUTPUT_7);

void pinModeExt(uint8_t pin, uint8_t mode)
{
const struct digital_pin_bitband_and_config_table_struct *p;
if (pin >= CORE_NUM_DIGITAL) return;
p = digital_pin_to_info_PGM + pin;
const uint32_t base_pad_flags = IOMUXC_PAD_SRE | IOMUXC_PAD_SPEED(3);
if (mode == OUTPUT || mode == OUTPUT_OPENDRAIN || (mode >= OUTPUT_1 && mode <= OUTPUT_7))
{
*(p->reg + 1) |= p->mask; // TODO: atomic
if (mode == OUTPUT) // Default
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(7);
}
else if (mode == OUTPUT_1)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(1);
}
else if (mode == OUTPUT_2)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(2);
}
else if (mode == OUTPUT_3)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(3);
}
else if (mode == OUTPUT_4)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(4);
}
else if (mode == OUTPUT_5)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(5);
}
else if (mode == OUTPUT_6)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(6);
}
else if (mode == OUTPUT_7)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(7);
}
else // OUTPUT_OPENDRAIN
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(7) | IOMUXC_PAD_ODE;
}
}
else
{
*(p->reg + 1) &= ~(p->mask); // TODO: atomic
if (mode == INPUT)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(7);
}
else if (mode == INPUT_PULLUP)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(7) | IOMUXC_PAD_PKE |
IOMUXC_PAD_PUE | IOMUXC_PAD_PUS(3) | IOMUXC_PAD_HYS;
}
else if (mode == INPUT_PULLDOWN)
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(7) | IOMUXC_PAD_PKE |
IOMUXC_PAD_PUE | IOMUXC_PAD_PUS(0) | IOMUXC_PAD_HYS;
}
else // INPUT_DISABLE
{
*(p->pad) = base_pad_flags | IOMUXC_PAD_DSE(7) | IOMUXC_PAD_HYS;
}
}
*(p->mux) = 5 | 0x10;
}
 

Attachments

  • 20250403_192811.jpg
    20250403_192811.jpg
    301 KB · Views: 22
Are you using a 10x scope probe to measure your signals (in order to reduce the capacitive loading) ?? Have your scope probes been tuned appropriately (see <this> article and <this> article on tuning) ??

Mark J Culross
KD5RXT
 
Last edited:
Are you using a 10x scope probe to measure your signals (in order to reduce the capacitive loading) ?? Have your scope probes been tuned appropriately (see <this> article and <this> article on tuning) ??

Mark J Culross
KD5RXT

Not sure how good the probe is tunned. Here is a picture running 24.58 MHz using 10X. 4ns raise time. I guess it make sense. Didn't realize about the capacitive loading.
Thanks a lot!

20250403_224320.jpg
 
Always run the scope probe in x10 mode. I've not yet come across a situation where there was a need to use x1 mode. The scope will normally have an option to take this into account in the voltages it displays.

Every scope I've ever used has had two metal terminals on the edge of the front panel that you can use for scope tuning, one is ground the other is a square wave output. Connect the probe to that and then dial the little screw terminal on the probe until it looks square.

Also when looking at this sort of thing the quality of the ground connection on the probe matters. You want it as short as possible and to a point as close as possible to the signal you are measuring.
 
As shown here. Also, the scope is rated at 200MHz bandwidth, so don’t read too much into the apparent 4ns rise time … plus as @AndyA says the connection quality has a significant effect at these speeds.
1743776686603.jpeg
 

Attachments

  • 1743776647352.jpeg
    1743776647352.jpeg
    156.2 KB · Views: 12
There are very few occasions you'd ever use x1 setting on a x10 probe - there's so much less bandwidth in x1 mode.
 
Thanks for everyones input. I'm less familiar with high speed digital applications. All your inputs help a lot. I think this answers all my questions and it allows me to move on to the next steps.
 
Back
Top