STM32H755ZI SPI / Behaviour of MOSI after disabling peripheral
- March 20, 2020
- 8 replies
- 2511 views
Hi everyone
I'm currently working with the STM32H755ZI SPI1 peripheral. I'm using low level driver to read 2 bytes of data. It works fine. I'm transmitting 2 dummy data bytes (0xFF) in order to get some response from the SPI slaves. However, I'm wondering about the behaviour of the MOSI signal after the transfer has been finished. I have attached a screenshot, the MOSI is the light blue / cyan signal (SCK is yellow, CS is green, and MISO is purple). Why is the signal cycled low and then high after I've finished the transfer? What could cause this behaviour? I assume the peripheral manages the state of the MOSI signal...
Parameters are as shown below:
Baudrate = LL_SPI_BAUDRATEPRESCALER_DIV256 (clock is 180MHz)
BitOrder = LL_SPI_MSB_FIRST
CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE
CRCPoly = CRCPOLY 0x00
ClockPhase = LL_SPI_PHASE_1EDGE
ClockPolarity = LL_SPI_POLARITY_LOW
DataWidth = LL_SPI_DATAWIDTH_8BIT
Mode = LL_SPI_MODE_MASTER
NSS = LL_SPI_NSS_HARD_OUTPUT
TransferDirection = LL_SPI_FULL_DUPLEX
I'm also setting the following parameters:
- LL_SPI_PROTOCOL_MOTOROLA
- LL_SPI_NSS_POLARITY_HIGH
- Enable NSS Pulse Management
- Enable GPIO Control
After initialization, I'm trying to read 2 bytes of data. I'm using the following procedure:
- Start the transfer size (with requested number of bytes)
- Enable the SPI peripheral and start master transfer
- Wait for TXP, send first dummy data byte (0xFF)
- Wait for TXP, send second dummy data byte (0xFF) and read first data byte if FIFO packing level is > 0
- Read second data byte if FIFO packing level is > 0
- Wait until EOT
- Clear EOT and TXTF flags
- Suspend master transfer and disable SPI peripheral
Any explanation would be greatly appreciated.
Regards
Daniel.
