2025-02-23 9:37 PM
Hi,
While using the SPI2 for transmitting a data in STM32F302R8, the transmitting data reflects in the DATA register only in the CPOL = 0(Low) and CPHA = 0(1st edge). In the other modes (CPOL and CPHA) the data is not reflecting in the DATA register.
My configurations:
Mode: Full-Duplex Master
Basic Parameters:
Frame Format: Motorola
Data Size: 8 Bits
First Bit: MSB first
Clock Parameters:
Prescaler (for Baud Rate):2
Baud Rate: 16.0 MBits/s
Clock Polarity (CPOL): High
Clock Phase (CPHA): 2 Edge
Advanced Parameters
CRC Calculation: Disabled
NSS Signal Type: Output Hardware (I tried for both Output Hardware and NSS signal type: Disable)
What might be problem with my configurations?
Here are my observations:
# | CPOL | CPHA | Status in DATA register |
Mode 1 | Low | Edge 1 | Data reflected correctly |
Mode 2 | Low | Edge 2 | Wrong data reflected |
Mode 3 | High | Edge 1 | No data reflected |
Mode 4 | High | Edge 2 | No data reflected |
Also, it is not mentioned in the errata either.
Has anyone faced this? Kindly help me with this.
Best regards,
Sanjay
2025-03-06 2:30 AM
Hello @Sanjay_Periyasamy and welcome to the Community,
Make sure that the CPOL and CPHA settings are correctly applied while the SPI is disabled.
Did you get a Hardfault or error_Handler?
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.