apm HAL uart set blocking writes and AP Scheduler Help


For last year or so I have been using 2.9.1b branch for work im doing where the ardupilot serves more as a sensor board and safety pilot. I wrote some basic code to send the sensor data over uart2 using custom messages(not mavlink) using Serial2.write. For two reasons I needed to switch to 3.0+: my onboard(apm 2.5) mag blew and 2.9 doesn't support external mag and I want to also support my new pixhawk board as well. To change to 3.0 code I could no longer use Serial.write and had to switch to hal.uartC and a couple other small changes.

Two things I noticed about the new code:

1) In Arducopter/system.pde:

if I don't comment out the line-> hal.uartC->set_blocking_writes(false)

the data I receive from putty etc. is not clean and I receive garbled data occasionally which screws up my checksums. By changing this could this cause big issue? The comment says this prevents pause in mid flight but I won't be able to fly if I can't get the data either.

2) ArduCopter/ArduCopter.pde

Currently I'm using the userhook_fastloop, etc.. to send/receive data from another onboard computer. My userhook_fastloop works and sends data but the other loops never get ran when they are on the bottom of the scheduler list. Just to try I moved the 50Hz loop up near the top and by doing that it entered the 50hz user loop. I just wanted to confirm with someone that the list for scheduler is ranked important to least? I didn't see anything about this in the wiki. Also whats the best way to get an idea of how long my custom loops run? grab the timer value before and after execution?


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


This reply was deleted.


sam liked Jimmy Oliver's profile
Aug 25
Mike Whitney liked Mike Whitney's profile
Jul 19
Abdulatif Tlaib liked Ryan's profile
Jun 24