Hej Rea,
I am not sure if I understand your question correcty:
"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.
"
I think that the motorRecord "talks" to the model 3 driver.
Which means that, somewhat simplified, when you write to the
VAL field in the motorRecord move() is called.
What next ?
move() has all freedom in the world to do what needs to be done.
(and all responsiblity, but we are protected by a mutex, so that
e.g only one move() is called at a time).
You don't need to use
writeController, readController and writeReadController.
They are there because most (!) controllers use ASCII and
all share the same principle.
You can, to my understanding, correct me if this is very wrong,
just issue a number of multiple pasynOctetSyncIO to do the move()
And use the spi driver to provide you with the asynOctet interface
which your driver code calls.
Best Regards
/Torsten
On 2026-07-09 13:52, Rea Domitrović via Tech-talk wrote:
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 Rea Domitrović via Tech-talk
- References:
- Drivers for SPI-based stepper motor controllers Rea Domitrović via Tech-talk
- Navigate by Date:
- Prev:
Re: support for LXI devices (Bustec ProDAQ 6150 specifically) Mark Rivers via Tech-talk
- Next:
Re: Drivers for SPI-based stepper motor controllers Rea Domitrović 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:
Drivers for SPI-based stepper motor controllers Rea Domitrović via Tech-talk
- Next:
Re: Drivers for SPI-based stepper motor controllers Rea Domitrović 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>
|