Hi all,
I would like to use the logger to log to an SD card connected to my Craziefly mini quadcopter. However, I’m running into a problem with starting the logger using any buffer sizes above 8 * 1024 bytes. Whenever I start the logger with something bigger, for example trough:
logger start -b 10
logger on
I get the following error:
“Can’t create log buffer”
This is the result of failing to set the pointer to point towards a new array created here.
If I try to use malloc the same issue occurs. I also tried to create a static array outside of the function and only set the pointer at runtime to point towards this array, but this causes the PX4 software to end up blocked in a loop it seems (startup LEDs keep flashing, and I can’t connect through the terminal with nuttx, although it does see the device).
Creating an additional array of the same size as the one I’m trying to get the pointer to point towards is no problem as long as I declare it within the local function context. So this works fine:
bool LogWriterFile::LogFileBuffer::start_log(const char *filename)
{
uint8_t test[20 * 1024];
test[1000] = 123;
PX4_INFO("test: %d", test[1000]);
...etc...
}
But this causes the drone not to boot anymore:
uint8_t test[20 * 1024];
bool LogWriterFile::LogFileBuffer::start_log(const char *filename)
{
test[1000] = 123;
PX4_INFO("test: %d", test[1000]);
...etc...
}
Making the test array static does allow me to declare it outside of the function, but like I said making the _buffer pointer point to such a statically defined array makes the software crash/loop/get stuck.
Can somebody point me in the right direction?