Jaeyoung-Lim / InRoL-Quadrotor-Platform-for-Research

Project for developing a quadrotor platform for research platform used in Seoul National University interactive networks Laboratory
1 stars 2 forks source link

Using interrupts stops arduino being able to communicate via Serial #1

Closed Jaeyoung-Lim closed 9 years ago

Jaeyoung-Lim commented 9 years ago

Serial decoding function works as well as the ppm generation/encoding function

but when I implement both, the code doesn't work

Jaeyoung-Lim commented 9 years ago

http://www.mftech.de/ppm_en.htm Reference for ppm signal information

shows ppm signal as a 22.5ms pulse with quite a long sync bit

ppp-schema2

ppp-schema

Jaeyoung-Lim commented 9 years ago

http://forum.arduino.cc/index.php?topic=8755.0

link above includes code for generating ppm signals without using interrupts

Jaeyoung-Lim commented 9 years ago

Tested problem not using interrupts.

Signal is received in the transmitter, but signal is inconsistant and unstable. Indeed the problem is caused because of the slow reading of serial.

I think a few approaches could be possible to solve the problem a. shortening the message sent by serial b. using a faster MCU (such as arduino mega) c. schedule tasks more precisely so that won't interrupt each other

Other impressions are that using timers in arduino can be unrecommened. Arduino is good for simple newbie or prototyping applications. Time sensitive applications such as ppm signal generation does not seem to be a sufficeint application for arduino

Jaeyoung-Lim commented 9 years ago

http://forum.arduino.cc/index.php?topic=8755.30

The link inlcudes information of using a time correction factor in the ISR

Jaeyoung-Lim commented 9 years ago

Problem resolved using timer correction codes

Pin 10 should be used for timer interrupts

Jaeyoung-Lim commented 9 years ago

http://www.avrbeginners.net/architecture/timers/timers.html