Hi all,
I'm working with an ST Microelectronics X-Nucleo IHM02A1 board, which is a daughterboard with two L6470 stepper motor controllers, plugged into a Raspberry Pi. The controllers talk over SPI, and if the headache wasn't bad enough, the two chips are daisy chained together and share the same chip-select line, rather than the standard SPI approach of giving each slave device its own line. I'm looking to develop an EPICS driver for those controllers so that we can use them to control steppers in the lab, and while there is an Asyn plug-in to enable SPI communication (https://urldefense.us/v3/__https://github.com/kek-acc/drvAsynSPI__;!!G_uCfscf7eWS!YDwm4DSyktS6YoYYgOF-qLUVEpcbvLzaBQ9yED4mw8XJRWQ5jbQ8o7rDnFRSAEHgNwWTkEjfdNC1ruyyDZJ5cnpiRT6Bvg$ ), I'm wondering if it might just be easier to bypass Asyn/model 3 and make a driver that talks to the motor record directly, using a different C++ library to handle the SPI communication.
So far, what I've figured out is: Due to the daisy chaining, data has to be sent interlaced, with zero-bytes for the L6470/motor we don't want to talk to. This means a single command with a 3-byte argument, such as jog, takes four SPI transmissions to fully propagate, each with one byte of the four-byte command frame. So, for example, jogging forward at 3/256 step/tick, for the device nearest the master:
Transmission 1: (0x00, 0x51)
Transmission 2: (0x00, 0x00)
Transmission 3: (0x00, 0x30)
Transmission 4: (0x00, 0x00)
This means, using Asyn, I would probably have to write custom writeController, readController and writeReadController functions with multiple pasynOctetSyncIO calls per command to make sure everything propagates through as needed. This doesn't sound too difficult, but that's assuming the Asyn/SPI driver even works as intended. On the other hand, bypassing Asyn would mean including a non-EPICS package as a dependency - I'm currently working with spidev_lib++.
Any suggestions and comments are more than welcome. Kind regards,
Rea Domitrović
Institut Ruđer Bošković
Zagreb, Croatia
- Replies:
- Re: Drivers for SPI-based stepper motor controllers Torsten Bögershausen via Tech-talk
- Navigate by Date:
- Prev:
Re: [EXTERNAL] Gamma DIGITEL MPCq: mismatch after 0 bytes "" Abdalla Ahmad via Tech-talk
- Next:
support for LXI devices (Bustec ProDAQ 6150 specifically) Evans, Richard K. (GRC-H000) via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
<2026>
- Navigate by Thread:
- Prev:
Re: [EXTERNAL] Gamma DIGITEL MPCq: mismatch after 0 bytes "" Abdalla Ahmad via Tech-talk
- Next:
Re: Drivers for SPI-based stepper motor controllers Torsten Bögershausen via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
<2026>
|