AnsweredAssumed Answered

STM32F746ZG SPI not receiving data, using CubeMX

Question asked by Matt Jackson on Jul 19, 2017
Latest reply on Jul 20, 2017 by Matt Jackson

Hi there, 

 

I'm trying to receive data over SPI using the Nucleo-F746ZG. I'm using Cube MX and AC6 Workbench. 

Unfortunately, there are no SPI examples for this board that use the drivers generated by Cube MX (That I can find at least..)

 

I have SPI1 enabled as a full duplex (Have also tried half duplex).

NSS is set to hardware input.

I have my pins configured like this: 

 

    /**SPI1 GPIO Configuration    

    PA4     ------> SPI1_NSS

    PA5     ------> SPI1_SCK

    PA6     ------> SPI1_MISO

    PA7     ------> SPI1_MOSI 

    */

 

I then used a logic analyser to ensure that all pins are connected properly and receiving data as they should. 

I have triple checked my SPI data/clock config and it's definitely correct.

I have enabled SPI global interrupt in both the SPI config and NVIC config in cube MX.

 

I then added this function to my main.c, just before the main function. I copied this from the weak declaration in the HAL driver.

 

void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)

  {

      HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_0);

  }

 

The green LED on the Nucleo board should toggle every time a byte of data is received on MOSI. It's not happening.

I have also checked the SPI1 data register, and there is never anything in it. 

 

I would put up more code, but it's all generated by CubeMX, so it should be fine.

 

Any help would be greatly appreciated - I'm pulling my hair out!!

 

 

Thanks, 

 

Matt

Outcomes