Saturday, December 23, 2017

FreeRTOS trace HW/SW with nw.js application

While working on CleanFlight Linux with a I/O micro-controller for extra peripherals, there is no straight forward way to get performance, trace, and general information about the state of the firmware on the micro-controller.


Goal:
  • Provide an open source solution to get metrics on the firmware using traceSWO port.
Implementation:
  • Use FreeRTOS trace messages and send them out one of the channels of SWO port
  • Also allow setting ETM tracing
  • Create a GUI (nw.js) and command line tools to parse and show trace data from FreeRTOS
    • GUI will show live line/bar charts of Task performance and I/O
    • python tools to parse/mine data allows custom reports.

I have several GD32F103C8 red boards, use these to decode the SWO and send trace information to nw.js application.

Thoughts? suggestions? 

Thursday, December 21, 2017

Cleanflight port to Linux (LinuxFlight) status

Created a new CLI (command Line Interface) module based on C++ and uses msgProtocol for subscribing/publishing messages.  This allows components (bash shell) or transports (UDP/TCP (Configurator)) to use the CLI at the same time.  So, now one instance of CLI can process messages from anywhere. For example: Linux has bash shell so, it would be nice not to startup Configurator to get basic info.  Use the bash shell

Here it is:
LinuxFlight>help
status - show status
help
tasks - show task stats
version - show v
LinuxFlight>status

System Uptime: 274 secondsVoltage: 0 * 0.1V (0S battery - NOT PRESENT)CPU Clock=500MHz, GYRO=MPU9250, ACC=MPU9250, MAG=AK8963
Stack size: 790724, Stack address: 0xc10b0CPU:0%, cycle time: 23226, GYRO rate: 43, RX rate: 282, System rate: 10Arming disable flags: TH
LinuxFlight>tasks

LinuxFlight>tasksTask list             rate/hz  max/us  avg/us maxload avgload     total/ms
00 - (         SYSTEM)     10       3       1    0.5%    0.5%         0
01 - (            PID)    444   22177     523  985.1%   23.7%      1270
   - (           GYRO)    889
02 - (          ACCEL)    997   21337     723 2127.7%   72.5%      1822
03 - (       ATTITUDE)     99     327      14    3.7%    0.6%         5
04 - (             RX)    143     166      36    2.8%    1.0%         9
05 - (         SERIAL)    101      87       4    1.3%    0.5%         1
08 - (BATTERY_CURRENT)    149      41       2    1.1%    0.5%         0
09 - ( BATTERY_ALERTS)      4       7       2    0.5%    0.5%         0
10 - (            GPS)     99     129       6    1.7%    0.5%         2
11 - (        COMPASS)     39   22825     756   89.5%    3.4%       158
14 - (      TELEMETRY)    255      39       2    1.4%    0.5%         0
15 - (       LEDSTRIP)    101    2522      74   25.9%    1.2%        30
RX Check Function                   0       0                         0
Total (excluding SERIAL)                      3239.9%
LinuxFlight>



Next is to get the battery voltage reporting and figure out the issue with the loading.

Might have to try the RT kernel but, first load LinuxFlight on to its own processor.  Also, might have to remove CPUFREQ it is known to impact realtime performance.



Saturday, December 16, 2017

CleanFlight on Linux using micro-controller for PWM/LCD

Finally have micro-controller sending PWM from a HK-T6A to Linux version of CleanFlight. 

Created a new protocol (protocolMsg), allowing to route messages between software components over UDP or within the app via message bus.

For example, CleanFlight has a PWM parallel RX IO software block and PWM RX driver block.  The PWM RX driver block was replaced with a PWM client protocolMsg handler, the micro-controller is a PWM server protocolMsg handler.  The messages are routed via UDP over USB.  

The goal is to update CleanFlight  CLI and msp to handle message processing from multiple transports, i.e. serial, UDP, TCP. 


CleanFlight Configurator is proper showing receiver status. USB/UDP is running at 28Kb/s for RPM messages.

To Do list:
  • validate new Linux serial driver
    • a simple libevent shim (same as UDP/TCP shim)
    • used for GPS
  •  validate new lcdStrip Shim
    • allows routing LCD strip messages (LED RGB) to be routed to micro-controller.
  • write dshot  shim
    • allow sending sdhot motor messages to micro-controller