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

CodePudding user response:

reference 1st floor forget345 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


On the initialization of SPI related pin, stm32cube automatically generated SPI in the initialization function has been initialized to SPI related pin


In addition, the "default of GPIO pin" what meaning be?

CodePudding user response:

For example some pins after power on default is the JTAG feet, some of them are OSC feet,
Debugging intuitive way or use logic analyzer monitoring signals of each pin is correct,

CodePudding user response:

A configuration seems to also do not have what problem, connect peripherals?
Can try the entire logical analysis

CodePudding user response:

I have been 0
  • Related