analogdevicesinc / TMC-API

TRINAMIC's IC API
MIT License
188 stars 83 forks source link

Remove duplicate function call #44

Closed grahas closed 10 months ago

grahas commented 10 months ago

Hi,

It looks like these lines were duplicated by accident. I don't think it is supposed to do the same thing twice.

thanks

joshua-8 commented 10 months ago

Hi @grahas, I've never used a tmc5160 so anyone please correct me if I'm wrong, but I've used other TMC drivers. My interpretation of 4.1.1 Selection of Write / Read (WRITE_notREAD is that the first read of a register tells the driver to prepare to send the data at that register, and that the data isn't read from the chip until a second read. https://www.analog.com/media/en/technical-documentation/data-sheets/TMC5160A_datasheet_rev1.18.pdf

Have you checked whether you can read different registers at random using your modified tmc5160_readInt function? If you only read one register repeatedly then I would guess that the modified function would work, but if you read different registers one after the next then there might be a problem.

Anyways, thanks @grahas and everyone else who works on this library.

Best, joshua-8

grahas commented 10 months ago

Hi,

Thanks for the quick reply. You are absolutely correct. Both are necessary. My mistake. I checked and the modified function doesn't work with random registers.

Thanks

joshua-8 commented 10 months ago

Thanks for reading the code with a critical eye - that's how problems get found, and thanks for confirming with a test in hardware. Best of luck with all your projects!