Page 1 of 1

Configure Crazyflie as SPI slave

Posted: Tue Oct 06, 2020 10:17 am
by marc345
Hello guys

I currently work on a project where I would like to attach a accelerator chip to the CF which does the computing for the Kalman filter algorithm. To enable the accelerator to get the sensor data from the CF and to write back the estimated state result I want to establish a SPI connection between the two. Unfortunately on the accelerator chip there is only a SPI master interface available, thus I have to configure the STM32 of CF as SPI slave.

Looking at the schematics of the CF and the datasheet of the STM32 (Table 9. Alternate Function mappings) I figured out that the SPI1_NSS Pin is on PA4 which currently serves as NRF_FLOW_CTRL for the radio. Thus I wont be able to use the SPI1 interface in slave configuration.

I can't find any code about the NRF_FLOW_CTRL pin assignment in the CF firmware, is there any way to reconfigure another free pin (say PC15 ) for this purpose? What is the use of NRF_FLOW_CTRL?

all the best
marc

Re: Configure Crazyflie as SPI slave

Posted: Thu Oct 08, 2020 8:19 am
by tobias
I have never used the CF in SPI slave mode but I don't think you need the SPI1_NSS pin, especially if you only have one master and one slave. You should be able to use any GPIO pin or continuously "listen" on the SPI port (as if was an uart).

Re: Configure Crazyflie as SPI slave

Posted: Thu Oct 08, 2020 8:24 am
by tobias
Thinking about it, in the PULP dronet implementation the CF2 was configured in SPI slave mode.

Re: Configure Crazyflie as SPI slave

Posted: Thu Oct 08, 2020 9:34 am
by marc345
Thanks for the reply tobias, actually I already looked at the dronet implementation, but I cant find any relevant code for the CF side in the github repo only for the GAP8 chip configuration and communication of the SPI master interface.
Is the CF code missing in the repo?

Update: I actually found the relevant code under the authors CF firmware repo

Re: Configure Crazyflie as SPI slave

Posted: Fri Oct 09, 2020 7:38 am
by tobias
Awesome!