klipper icon indicating copy to clipboard operation
klipper copied to clipboard

SPI3 not correctly assigned on STM32H7XX MCU based boards

Open jaysuk opened this issue 2 years ago • 5 comments

the issue is this line here https://github.com/Klipper3d/klipper/blob/master/src/stm32/stm32h7_spi.c#L70 it assigns all 3 SPI3 pins to function 6 but on the H742x/H743x at least that would configure PB4 and PB3 for SPI3 but PB5 would end up talking to the I2C4 device! To get PB5 to talk to SPI you need to set it's alternate function number to 7 not 6, which it appears that the current code doesn't let you do.

Look at page 89 of datasheet: https://www.st.com/resource/en/datasheet/stm32h743vi.pdf This issue specifically affects the fly-super8pro board, that uses hardware SPI 3 for TMC driver control

@adelyser I believe you were the original author of this code.

jaysuk avatar Sep 15 '22 05:09 jaysuk

I did author this code, and you are correct, PB5 needs a different function number. I didn't have anything that tested that particular SPI3 connection, so it was missed. I can implement a change to fix that, but I'll need some help testing that it works since I don't have a device to test with.

adelyser avatar Sep 25 '22 05:09 adelyser

Of course. Happy to test whenever you've got something.

On Sun, 25 Sept 2022, 06:12 adelyser, @.***> wrote:

I did author this code, and you are correct, PB5 needs a different function number. I didn't have anything that tested that particular SPI3 connection, so it was missed. I can implement a change to fix that, but I'll need some help testing that it works since I don't have a device to test with.

— Reply to this email directly, view it on GitHub https://github.com/Klipper3d/klipper/issues/5773#issuecomment-1257121993, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATUSBXUNOABPUPRJOCSRKTV77NLFANCNFSM6AAAAAAQNBH4VE . You are receiving this because you authored the thread.Message ID: @.***>

jaysuk avatar Sep 25 '22 06:09 jaysuk

Of course. Happy to test whenever you've got something. On Sun, 25 Sept 2022, 06:12 adelyser, @.> wrote: I did author this code, and you are correct, PB5 needs a different function number. I didn't have anything that tested that particular SPI3 connection, so it was missed. I can implement a change to fix that, but I'll need some help testing that it works since I don't have a device to test with. — Reply to this email directly, view it on GitHub <#5773 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATUSBXUNOABPUPRJOCSRKTV77NLFANCNFSM6AAAAAAQNBH4VE . You are receiving this because you authored the thread.Message ID: @.>

You can test with the PR linked to this issue

adelyser avatar Sep 25 '22 07:09 adelyser

Of course. Happy to test whenever you've got something.

So it does seem you could just use SPI1a for those pins, correct?

adelyser avatar Sep 30 '22 23:09 adelyser

This should be fixed (by removing spi3) in commit e4c8a247.

-Kevin

KevinOConnor avatar Nov 01 '22 15:11 KevinOConnor

This ticket is being closed because the underlying issue is now thought to be resolved.

Best regards, ~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

github-actions[bot] avatar Nov 09 '22 00:11 github-actions[bot]