hal: Update the hostmot2 drivers to getter/setter - #4369
Conversation
|
Was wondering why it was so quiet here... Might be able to test on a 5i25 as well. |
|
For people who use stepgen and set the |
645714b to
f62097a
Compare
|
I can check some of this next week. |
|
Built and tested on the 5i25 Also noticed a small detail while testing mode 20, we may want to fix here: Other than those minor things, it works well (on a bench test with only the 5i25 plugged in), tested a few firmware, stepgen pwmgen, encoder, all good. I did what I could with sserial I don't actually have an sserial devices but the firmware loads ok, at least no regression there, Rene's symptoms from #4247 are untested without 7i76 or friends which I don't have. |
f62097a to
858a83b
Compare
A genuine preexisting bug. Fixed. The first check only handled the config (when you set num_pwmgens=0). There is now a second check for zero pwmgens before the hal_malloc that checks the number actually present.
A preexisting text error, also fixed. |
Yeah, a bug that was not biting till your changes though...🐞 |


This is the last in the series to update the code base to the HAL getter/setter infrastructure.
The hostmot2 drivers are a very large interconnected set of drivers in several layers that are, unfortunately, difficult to migrate step by step. This PR needs to be reviewed and tested on real hardware before it can be merged.
All changes have been tested on a RPi5 with an 7i96s board+modbus. It is therefore known that at least the basic outline of the driver is functional and behaves as it has done before.
The main issue in porting the hostmot2 drivers (and also others) has been the (ab)use of parameters. Other drivers had similar problems, but they could be handled one-by-one. Parameters are now similar to pins, which means all use of parameters (as expensive local variables) had to be detected and adapted.
An important test is with attached smart serial board(s). The sserial driver is known to have some quirks and has code that needed special attention while porting. Note that the sserial/abs_encoder part has been internally changed slightly. The Fanuc style absolute encoder had an overlapping value, which now has been untangled. It should not change behaviour or appearance for the user, but it is nice if it can be tested, just like the other absolute encoders.
It is also necessary to test this with a variety of boards, both networked and local PCI bus boards (and others). Also, the more configurations that can be tested, the better we can guarantee that no hidden defects are present.
@pcw-mesa you probably have most hardware, somewhere. Have a go, please, with different setups if possible.
@rene-dev you have tested earlier with a smart serial board, please try again.
Anybody else, please test and report.
Edit to add:
...stepgen.NN.step_typeis now capped at 16 to prevent read/write to unknown memory. There may be more failure modes when you set step_type to larger than 16, but that has not been considered.