Home > other > Stm32L476 use SPI function HAL_SPI_TransmitReceive read data error ()
Stm32L476 use SPI function HAL_SPI_TransmitReceive read data error ()
Time:09-30
Recently used STM32L476 drive NRF2401 wireless module, spi set by cube, the elder brother to shift the atom F407HAL drive NRF2401 routines, found that after the modification of the corresponding pin check pass, namely can't detect the existence of the module, is found by screening in HAL_SPI_TransmitReceive (& amp; SPI1_Handler, & amp; Buffer, & amp; Rdbuf, 1, 1000); The problems found no matter what is buffer values, Rdbuf return value of 9,
To verify this after initialization spi, run the following code in the main: A return value of Rdbuf still 9, is this why? To solve!
Ps: The maximum 80 MHZ clock according to the default configuration Spi configuration is cube automatically generated, in addition to shift from the atoms of routines in the following code in spi. C file
CodePudding user response:
1, the code is not complete, not remember Hal does the library need to initialize the pin, whether or not to use the default of GPIO pins, so need 2, the logic analyzer is a good tool