Multiwii + FreeRTOS

Post Reply
Neigh
Posts: 13
Joined: Wed Dec 19, 2012 4:04 pm
Location: Moscow, Russia
Contact:

Multiwii + FreeRTOS

Post 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

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Multiwii + FreeRTOS

Post by timecop »

Does it compile with Arduino IDE?

Neigh
Posts: 13
Joined: Wed Dec 19, 2012 4:04 pm
Location: Moscow, Russia
Contact:

Re: Multiwii + FreeRTOS

Post by Neigh »

No. At this stage it's only an idea because i use PICmicro device, not Atmel.

User avatar
Hamburger
Posts: 2582
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Multiwii + FreeRTOS

Post by Hamburger »

what are resources requirements for your rtos implementation?

Neigh
Posts: 13
Joined: Wed Dec 19, 2012 4:04 pm
Location: Moscow, Russia
Contact:

Re: Multiwii + FreeRTOS

Post 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.

User avatar
Hamburger
Posts: 2582
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Multiwii + FreeRTOS

Post 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?

Neigh
Posts: 13
Joined: Wed Dec 19, 2012 4:04 pm
Location: Moscow, Russia
Contact:

Re: Multiwii + FreeRTOS

Post 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?

Post Reply