Details

I have my board underclocked - down from the max 120 MHz core / 60 MHz peripheral clocks to 24 MHz for both. The fastest I can toggle a GPIO output pin gives me about a 20 µs pulse or more, but I need to be able to do < 15 µs reliably. (Running the board at full speed lets me get down in the 5 µs range. I was able to read the temperature from the device a couple times, but the pulsewidths aren't uniform, which makes me unsure if it's possible to do reliably this way, even at the max clock speed.)

Probing the output pin with an oscilloscope shows the same pulsewidths regardless of whether I use the DigitalOut interface, or if I access the registers directly.

EDIT: Update

I got it toggling quickly by modifying mbed-os-example-blinky, so I guess I'm doing something else in my program to cause it. Investigation continues...

====Problem
Using Mbed OS (v5.8.4), GPIOs can only toggle about every 5 µs max. Why? They can toggle on the order of tens of ns using the bare metal LPCOpen platform.
How can I reliably create one-shot pulses measured in single digit microseconds on Mbed OS?
====Details
I'm trying to interface a DS18B20 1-wire temperature sensor to my [[https://www.embeddedartists.com/products/boards/lpc4088_qsb.php|Embedded Artists LPC4088QSB]] board. I see that there are [[https://os.mbed.com/search/repository?q=DS1820|several drivers out there]], but they're not working in my scenario.
I have my board underclocked - down from the max 120 MHz core / 60 MHz peripheral clocks to 24 MHz for both. The fastest I can toggle a GPIO output pin gives me about a 20 µs pulse or more, but I need to be able to do < 15 µs reliably. (Running the board at full speed lets me get down in the 5 µs range. I was able to read the temperature from the device a couple times, but the pulsewidths aren't uniform, which makes me unsure if it's possible to do reliably this way, even at the max clock speed.)
<<code>>
int main()
{
DigitalOut testPin(P0_26);
{
CriticalSectionLock lock;
for (int i = 0; i < 10; i++)
{
//testPin.write(0);
//testPin.write(1);
LPC_GPIO0->SET = (1 << 26);
LPC_GPIO0->CLR = (1 << 26);
}
}
// ...
}
<</code>>
Probing the output pin with an oscilloscope shows the same pulsewidths regardless of whether I use the DigitalOut interface, or if I access the registers directly.
====EDIT: Update
I got it toggling quickly by modifying [[https://github.com/ARMmbed/mbed-os-example-blinky|mbed-os-example-blinky]], so I guess I'm doing something else in my program to cause it. Investigation continues...

Important Information for this Arm website

This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.