I am trying to instrument the firmware code and log time stamps onto a uSD card. Primarily I want to use the Event trigger framework to log things in the stabilizer.c file. I have a few problems which I would be very grateful if anyone could help me a bit with.
1) The guide https://www.bitcraze.io/documentation/r ... card-deck/ mentions that one should start/stop logging with the usd.logging boolean. But I don't know how to get access to usd, it seems to be declared as a parameter group in usddeck.c only, but one must be able to access it in some other way?
2) I can't log anything to the SD . By that I mean that after changing the firmware as I describe below and running python scripts like flowsequenceSync.py from the crazyflie-lib-python repo, no new file appears on the sd-card. And I have made sure to insert the SD card correctly before starting the crazyflie (and I have an attached flow deck if that is of interest). This might be due to not being able to set usd.logging to 0, but if it should work without that I don't get what I missed. Here is what I have added:
In stabilizer.c I added
Code: Select all
// Imports and declares the myLoopEvent
#include "eventtrigger.h"
EVENTTRIGGER(myEvent, uint8, var1)
Code: Select all
// The sensor should unlock at 1kHz
sensorsWaitDataReady(); // no change
// Sets the value of the var1 variable
eventTrigger_myEvent_payload.var1 = tick;
// Trigger the event
eventTrigger(&eventTrigger_myEvent);
if (healthShallWeRunTest()) // No change
Then I changed in the config.txt file which should be config for the SD card. I changed it to:
Code: Select all
1 # version
512 # buffer size in bytes
log # file name
1 # enable on startup (0/1)
on:fixedFrequency
1 # frequency
1 # mode (0: disabled, 1: synchronous stabilizer, 2: asynchronous)
"second" # Just write "second" once per second
on:myEvent # Do just want to log the payload really
"loop"
Are there any glaring issues with this?
3) Finally I would also later want to log the time stamps at different parts of the code. Is there an easy way to access some time value, like a hardware tick? I have not looked super much, but have only found the software tick in FreeRTOS so far, which maybe is not optimal to use as a clock.
As I said I would be very grateful if anyone had any input :)