Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bbob1
Beginner
1,532 Views

How can I use the MCU to toggle GPIO pins faster?

I've got the following application running on my MCU

void mcu_main()

{

/* your configuration code starts here */

gpio_setup(48, 1); /* set GPIO 48 as output */

while (1)

{

gpio_write(48, 1);

mcu_sleep(100); /* sleep 1 second */

gpio_write(48, 0);

mcu_sleep(100);

gpio_write(48, 1);

gpio_write(48, 0);

}

}

The signal is constant for ~1 second as expected for the first two writes, but for the last two it takes 24us for the signal to go from high to low. What can I change to decrease this time?

0 Kudos
3 Replies
FerryT
Valued Contributor I
39 Views

The CPU can toggle in about 2us (if I remember my measurements correctly) if you used memmapped io (which is easy if you use mraa). Of course the CPU doesn't behave very real time. At any time you might see delays of 10ms - 100ms. If you use the preempt_rt patches for the kernel these delays decrease to 1ms or so.

Unfortunately the MCU and Rocket OS is not documented very well. Maybe one day the Edison will be supported one day by the Wind River Helix platform (as promised long ago, but that page seems to have mysteriously disappeared, the forum response here ) so we have acces to the sources.

idata
Community Manager
39 Views

Hi Steven____,

 

 

Do you have any more questions regarding the MCU? Please let me know in order to assist you.

 

 

Have a nice day!

 

 

Best Regards,

 

-Jose
idata
Community Manager
39 Views

Hi Steven_______,

Thanks for your interest in the Intel Edison Platform.

I think that you might found this document interesting, it shows each pin toggle speed: http://www.intel.com/content/www/us/en/support/boards-and-kits/intel-edison-boards/000020080.html MCU Digital Pin On/Off Toggle Speed .

Also you can manage to increase the speed of your GPIO by using the mraa library, but this can only be achieved using the Edison CPU: http://www.i-programmer.info/programming/hardware/8770-exploring-edison-fast-memory-mapped-io.html?s... Exploring Edison - Fast Memory Mapped I/O .

Hope you find this information useful, have a nice day!

Best Regards,

 

-Jose.
Reply