Closed prothen closed 3 years ago
Hey @prothen welcome!
I think that you're probably seeing a board-specific issue. I don't think we've ever tested on that board, and looking at the implementation, i can see where things might be going wrong.
I also don't have a board like that to test locally, but I'll bet we are hitting
because it doesn't actually have M25P16 installed.
I'm not quite sure how to proceed. We can attempt to use the F4 EEPROM instead of the SPI flash chip, or the SD card. The parameter struct is so small, I'll bet that it'll fit on the EEPROM, however I'm not sure that we ever got it working. @BillThePlatypus, do you know if the EEPROM stuff works? Looking at the git history, that looks like it was mostly your work.
Using the EEPROM is probably the fastest way to get things working, since it will be the same across boards.
Thanks for getting back so quickly!
I didn't have time to look into a few things yet and am a bit unsure about the following:
backup_sram
used for?M25P16
and make EEPROM standard or is it potentially limiting future developments if space runs out, or what was the main motivation to choose external storage in the first place?airbourne_f4
is an abstraction for all STM32F4
chips, but how and where are FC implementation specifics differentiated, such as the missing M25P16 in the Xrotor nano F4
case.rosflight
issue, shall I reopen an issue for firmware
and we close this with a reference? I then could create a branch for us with a WIP
PR on the firmware
repository to discuss further and on the weekend I could attempt on chip debuggingSTM32F4
pinout to the Xrotor nano F4
exposed pads, are those usually open sourced somewhere?I can answer some of your questions.
backup_sram
is used in case of a firmware crash. It is a small portion of the memory that is not cleared on reboot. A small amount of information is stored there, so that in the case of a firmware crash, the vehicle can hopefully reboot and continue flying.AirbourneBoard
that replaces functions such as memory_write
to work with EEPROM instead of flash. This issue has been mentioned on ROSflight. There might be relevant details there:
https://discuss.rosflight.org/t/firmware-port-to-xrotor-nano-f4/60/1
Thanks for all your feedback so far!
I am currently stuck since I can't debug my firmware changes on-chip. (The nano board does not explicitly expose the SWD pins and the support prefers to not share any hardware information related to it.)
Do you have suggestions on how I could proceed with this board? I was hoping to contribute a EEPROM based board layout for it, but since it constitues more changes where things could go wrong, I don't want to attempt it blindly without on-chip debugging. Maybe you see an intermediate solution that I can attempt with only small adaptions to the M25P16 to get things working in the current setup?
I am now also looking into a replacement FCU. Is there one that you would prefer for more longer term support? I would also be interested to work on the porting to a F7 creating a more standardised setup process to alleviate entry barriers.
@superjax and @BillThePlatypus Do you know what could be the reason for num_errors
in the /status
message to be continuously increasing although the error_code
is zero and all sensor readings under /attitude
look good. (The num_errors
also seems to overflow at some point and then becomes negative. It then continues to decrease instead until positive.)
Edit: I tracked it down to be part of the board implementation using ext_i2c
here . It looks like it is only for sonar and airspeed sensors, so I can ignore it in my case right?
Yeah, you can ignore it. It should stop counting if you arm.
The errors indicate a failed i2c command. This happens when we are polling for sensors that aren't there, but it could also happen if a sensor were to stop responding. We don't look for sensors if the FCU is armed.
When I build from source under the untouched v1.3.0 tag everything still works as expected and all error messages disappear. If I checkout to master, the RC_LOST error remains. I couldn't find features related to the RC that could have caused this. Do you have an idea where this error could come from?
Edit:
I have tried to replace the sram with but it does not seem to work. It does not freeze anymore but instead just stops for .5s while /param_write
and then continues streaming data. After a power toggle the written parameters are not recovered but it is uninitialised.
// non-volatile memory
void AirbourneBoard::memory_init()
{
return eeprom_init();
//return flash_.init(&spi3_);
}
bool AirbourneBoard::memory_read(void *data, size_t len)
{
return eeprom_read(data, len);
//return flash_.read_config(reinterpret_cast<uint8_t *>(data), len);
}
bool AirbourneBoard::memory_write(const void *data, size_t len)
{
return eeprom_write(data, len);
//return flash_.write_config(reinterpret_cast<const uint8_t *>(data), len);
}
Edit2: I just noticed that due to everything running in detached tmux shells I missed to share the output for most events.
The parameter writing is reported to be successful.
[ INFO] [1622947674.276260624]: Param write succeeded
[ INFO] [1622947674.276386580]: Onboard parameters have been saved
Below the output for params.h
/params.cpp
, which are initialised based on the successful read using the board.memory_read()
and then printing using a mavlink log message statustext
which is also available on ROS. So following the output of rosflightIO
, this is an active ROS node right after the power toggle reconnection.
Could it be that the len parameter is just uint8_t
, seems a bit small for the printed size of 2384?
For reference :
Changing the length to uint16_t
fixed it, hope the documentation of the off-chip debugging will be useful to someone in the future. :D
Thanks for the eeprom suggestion and all the guidance!
First of all thank you very much for creating and sharing this amazing repository, it has been and still is a great pleasure to explore all of its features!
I am currently encountering a problem with the writing of parameters and was hoping to figure out why and get a more convenient non-volatile parameter configuration.
My setup is based on the
Xrotor nano F4
board and everything is working nicely so far, except the/param_write
seems to freeze the FC.My setup process is
/param_write
(Simulation works seamlessly for both, also with/param_write
)rosflight_io
via/dev/ttyACM0
/calibrate_imu
MIXER 2
RC_TYPE 1
/status
shows no errors/param_write
returns True but FC becomes unresponsive and does not publish to any topic (e.g./status
/imu/data
) and requires power toggle (losing all defined parameter values in the process, so the writing does not seem to be successful)OMNIBUSF4SD
)Am I missing something for using
/param_write
or is it maybe FC related (No SD card)?ps: I tried alternatively to fetch parameters using
/param_save_to_file
and/param_load_from_file
but it does not seem to keep all parameters (error code for imu not calibration present after loading the file. Which although it shows to load calibration parameters in the console log, still seems to require the IMU calibration to be redone).