Configure Crazyflie as SPI slave

Discussions about quadcopters/multi-rotors
Post Reply
marc345
Beginner
Posts: 3
Joined: Mon Aug 24, 2020 8:02 pm

Configure Crazyflie as SPI slave

Post 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
tobias
Bitcraze
Posts: 2059
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Configure Crazyflie as SPI slave

Post 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).
tobias
Bitcraze
Posts: 2059
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Configure Crazyflie as SPI slave

Post by tobias »

Thinking about it, in the PULP dronet implementation the CF2 was configured in SPI slave mode.
marc345
Beginner
Posts: 3
Joined: Mon Aug 24, 2020 8:02 pm

Re: Configure Crazyflie as SPI slave

Post 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
tobias
Bitcraze
Posts: 2059
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Configure Crazyflie as SPI slave

Post by tobias »

Awesome!
Post Reply