cancel
Showing results for 
Search instead for 
Did you mean: 

When I write to a L6474 Register, I do not get the same result back.

KiptonM
Lead

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.

0693W00000Y7JqaQAF.png 

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

0693W00000Y7P5VQAV.png 

JW

View solution in original post

3 REPLIES 3

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.

0693W00000Y7P5VQAV.png 

JW

KiptonM
Lead

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...

KiptonM
Lead

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.