TMC429 icon indicating copy to clipboard operation
TMC429 copied to clipboard

Compatibility issue with Arduino portenta C33

Open lars2696 opened this issue 1 year ago • 2 comments

Hello,

I am trying to use an arduino pro portenta c33 with 2 TMC429.

Currently i am only trying to get the TMC429 on a breakout board(specifically the TMC429-BOB https://www.analog.com/media/en/technical-documentation/user-guides/tmc429-bob-user-manual.pdf) to communicate with the C33.

I have a 16 MHz quartz oscillator for the CLK on the breakout board as well as all SPI pins connected correctly. The TMC429 is connected in the 3,3V operating mode.

When using the “TestConnection” example that comes with the library i get this:

23:47:02.466 -> communicating: 0 23:47:02.466 -> version: 801918 23:47:02.466 -> velocity_max_upper_limit: 406051 23:47:02.498 -> setLimitsInHz: 100, 100000, 40000 23:47:02.498 -> acceleration_max: 322341919 23:47:02.498 -> acceleration_max_upper_limit: 19 23:47:02.498 -> acceleration_actual: 0 23:47:02.498 -> velocity_min: 0 23:47:02.498 -> velocity_max: 0 23:47:02.498 -> set target_velocity: -50000 23:47:02.498 -> target_velocity: 812500 23:47:02.498 -> actual_velocity: 0 23:47:02.532 -> set target_position: 12345 23:47:02.532 -> set target_position: -8388608 23:47:02.532 -> actual_position: -8388608 23:47:02.532 -> at_target_position = 1 23:47:02.532 -> at_target_velocity = 0 23:47:02.532 -> After disabling, right switches enabled = 0 23:47:02.566 -> After enabling, right switches enabled = 0 23:47:02.566 -> After disabling, switch soft stop enabled = 0 23:47:02.603 -> After enabling, switch soft stop enabled = 0 23:47:02.603 -> After disabling, left switch stop enabled = 1 23:47:02.603 -> After enabling, left switch stop enabled = 1 23:47:02.603 -> After disabling, right switch stop enabled = 1 23:47:02.644 -> After enabling, right switch stop enabled = 1 23:47:02.644 -> left_switch_active = 1 23:47:02.644 -> right_switch_active = 1 23:47:02.644 -> latch_position_waiting: 0 23:47:02.644 -> latch_position: -8388608 23:47:02.644 -> status.at_target_position_0 = 0 23:47:02.644 -> status.switch_left_0 = 1 23:47:02.681 -> status.at_target_position_1 = 0 23:47:02.681 -> status.switch_left_1 = 0 23:47:02.681 -> status.at_target_position_2 = 0 23:47:02.681 -> status.switch_left_2 = 0

It is always the same and not changing. I tried the same setup with an Arduino mega (in 3,3V and 5V mode) and I got the expected result.

I tried a bunch of things both hardware and software. I reduced the SPI transfer speed in the library and used level shifter(and some more things) but I can't get it to work.

When trying to fix the problem i took pictures of the entire communication for the “communication sketch” (tmc429.communicating()).

This one is for the working Version on the arduino mega.

arduinomega(working)

and this one is a non-working exchange with C33.

c33(not working)

Yellow --> Chip Select Green --> Serial Clock Blue --> COPI (MOSI) Red --> CIPO (MISO)

On a side note: on the bottom of the picture is the decoded SPI data. I could not get it to work for the C33 Version even with adjusting the thresholds. (Also sorry for the white background, i only noticed that afterwards)

Any ideas what else i could try. (i am still waiting for higher frequency oscillator).

lars2696 avatar Apr 07 '24 22:04 lars2696

That is frustrating, but interesting. I do not know why the portenta SPI would behave so differently. It is very strange that the MOSI line would be changing before the clock. I can see it changing once to put it into the proper initial condition, depending on the SPI mode, but changing twice seems suspicious.

I have never used the portenta, but I suspect it might be some issue with how you are using their SPI library. I am not sure what could be in this library to cause such a problem, but perhaps.

It would be great to figure out how to make this work, but right now I do not have many ideas other than reading about potential issues with portenta SPI.

peterpolidoro avatar Apr 10 '24 17:04 peterpolidoro

I still think it has something to do with the 3.3V operation mode. I just noticed that in these screenshots the IC is still in 5V mode (MISO response is up to 5V). I currently don't have access to an oscilloscope. When i get the time to test that i will give updates, but since i have deadline, will switch to a different µC.

lars2696 avatar Apr 10 '24 22:04 lars2696