Page 1 of 1

Multiwii + FreeRTOS

Posted: Mon Jun 03, 2013 8:34 am
by Neigh
What anybody think about subj? Main cycle will be fixed time delay ( read sensors, filter it and apply PID), with max priority. Other threads like buzzer, OSD, Led,Sonar, Baro and UART with low priority. CPU time will most balanced.
I have adopted sources for PIC32MX795F512H ( 80MHz ~80MIPS). Now in a testing stage with PID ajusting.
Acc/GYRO: MPU5060
MAG: HMC5983
BARO: MS5611

Next devices exists on board but not used (still writting code to support it)
GPS: NV08C-CSM
Sonar: HC-SR04

Re: Multiwii + FreeRTOS

Posted: Mon Jun 03, 2013 8:37 am
by timecop
Does it compile with Arduino IDE?

Re: Multiwii + FreeRTOS

Posted: Mon Jun 03, 2013 8:46 am
by Neigh
No. At this stage it's only an idea because i use PICmicro device, not Atmel.

Re: Multiwii + FreeRTOS

Posted: Mon Jun 03, 2013 8:57 am
by Hamburger
what are resources requirements for your rtos implementation?

Re: Multiwii + FreeRTOS

Posted: Mon Jun 03, 2013 9:08 am
by Neigh
about 2kb RAM for RTOS (sheduler) + about 200 bytes RAM on every running thread ( stack ). If you mean FLASH resources, compilled project about 56kb. My project is so big size cause USB CDC Com Port emulation due to use MultiWii GUI.

Re: Multiwii + FreeRTOS

Posted: Mon Jun 03, 2013 9:44 am
by Hamburger
ok, thanks.
I guess you mostly adopted the main loop() code to suit the rtos capabilities?
From your experience so far, what do you consider to be the main readl world extra functionality and advantage you get from using an underlying rtOS?

Re: Multiwii + FreeRTOS

Posted: Mon Jun 03, 2013 10:41 am
by Neigh
Since i use MPU5060 with prescaler equal 15 (8000/15) = 500 Hz -> 2ms for one measurement for GYRO+ACC. In this case part of main loop() called every 2ms (+/- 100 us) that consist of filter for ACC and GYRO. To get one MAG measurement need to spend 6ms and next part of loop() code, that calc angle[ROLL], angle[PITCH], heading and applying PID params for motors throttle. Next thread with (prio-1) used to get rcData[] from transmitter and calc rcCommand, called every 20ms. Other low prio threads used for UART, LED, Buzzer, GPS, Sonar and Baro. To calc baro i need to spend 3 times of 8ms, so baro can be calculated every 24ms and it's not time sensitive. After all main thread remainig 2ms all time so time sensitive calculations will have less error.
Is anybody hear about Madwick MEMS filter?