-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for TMC5160 #73
Comments
It is a little more involved than that, best is to start with code from another driver. There are two SPI modes for Trinamic drivers, either separate chip select lines for each drivers or a common one. The latter requires the SPI lines to be chained and the drivers appear as a single long register. Part of the STM32F4xx driver code can be used as a starting point. To save pins you can use the existing SPI interface provided in spi.c. |
I was able to get TMC5160 working on RP2040 but only one drive is working at the moment. There's a driver.cs_pin variable declared in trinamic_motor_t struct, but don't know where I can assign it so I can use it later in tmc_spi_write() and tmc_spi_read() ? |
The STM32F4xx driver code linked above has separate chip select lines for each driver, this board specific code has a shared line for chained drivers. driver.c needs to be updated to handle the chip select(s), again see the STM32F4xx driver here and here. The latter code ensures the pin(s) are enabled as outputs with the level set high initially. |
Thank you for the help. I got it working now! 👍 I'm using the output from HC595 shift register for CS pins and I didn't initialize them as high and was causing SPI bus collision |
I would like to add support for TMC5160 which uses SPI but not sure where to start?
Do I add a new file call tmc_spi.c and include the two functions:
tmc_spi_write() and tmc_spi_read() ?
The text was updated successfully, but these errors were encountered: