2023-01-03 11:13 AM
A very simple example of this is Register 0x16 Which is STEP_MODE register.
It says Bits 3 and 7 are always 1. I write 0xCC to the 8 bit-register. When I read it, it reads as 0x4C
Write Param is just the ADDRESS sent. Read Param bit 5 is set to 1. So 0x16 becomes 0x36 to read register 0x16.
To make sure it is not my software, (I am using HAL) I have the logic analyzer output attached.
The SCK frequency is 4.1 MHz, it must be less than 5.0 MHz
The shortest CS high is 915 ns, it must be greater than 800 ns.
So, I do not believe it is timing related.
What am I missing?
Solved! Go to Solution.
2023-01-04 06:43 AM
The L6476 DS indicates it uses SPI Mode 3 (CPOL=1, CPHA=1), whereas you appear to have set SPI Mode 0 in the mcu.
JW
2023-01-04 06:43 AM
The L6476 DS indicates it uses SPI Mode 3 (CPOL=1, CPHA=1), whereas you appear to have set SPI Mode 0 in the mcu.
JW
2023-01-04 07:43 AM
Thanks, Let me look at that. I was just using the HAL, Let me see how that can be fixed in the HAL or if I have to change a register directly.
Thank you for the pointer as to where to look.
Of course the Configuration tool does not make that easy. CPOL is Low or High and CPHA is 1 edge or 2 Edge.
It was Low, 1 Edge, so mode 3 must be High, 2 Edge...
2023-01-04 07:55 AM
Yes that fixed about three problems I was having. Bit 7 was always 0.
Thank you very much. That issue was not even on my radar.