Mesa modbus and pktUart
07 Sep 2023 20:23 - 07 Sep 2023 20:26 #280227
by Donno
Replied by Donno on topic Mesa modbus and pktUart
Last edit: 07 Sep 2023 20:26 by Donno.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
08 Sep 2023 06:40 #280247
by Donno
Replied by Donno on topic Mesa modbus and pktUart
After re-write of driver everything works as expected :
pktuart for modbus is much better than usb to modbus with mb2hal. On pktuart i get modbus checksum error but that is to be expected as i am using unshielded modbus wires and these chinese servo drives are noisy ! I manage to remove all exsta resistor from tty2modbus and everything still works, signal is alot more noisy without 620 ohm resisitors.
In modcompile if u use it like ./modcompile to compile mod file i get error that it can't find makefile so i had to include dir on line 45
to
if someone can commit it ?
// Lichuan A5 AC Servo Drive Driver
#define MAX_MSG_LEN 16 // may be increased if necessary to max 251
#define DEBUG 3
static const hm2_modbus_chan_descriptor_t channels[] = {
/* {TYPE, FUNC, ADDR, COUNT, pin_name} */
{HAL_FLOAT, 3, 0x9C8, 1, "speed-actual"},
{HAL_FLOAT, 3, 0x9C9, 1, "speed-instruction"},
{HAL_FLOAT, 3, 0x9CA, 1, "torque-instruction"},
{HAL_FLOAT, 3, 0x9D4, 1, "avg-load-rate"},
{HAL_FLOAT, 3, 0x9E0, 1, "phase-current"},
{HAL_FLOAT, 3, 0x9E2, 1, "bus-voltage"},
{HAL_FLOAT, 3, 0x9E3, 1, "tempreture"},
{HAL_S32, 6, 0x4CB, 1, "set-speed"}
};
pktuart for modbus is much better than usb to modbus with mb2hal. On pktuart i get modbus checksum error but that is to be expected as i am using unshielded modbus wires and these chinese servo drives are noisy ! I manage to remove all exsta resistor from tty2modbus and everything still works, signal is alot more noisy without 620 ohm resisitors.
In modcompile if u use it like ./modcompile to compile mod file i get error that it can't find makefile so i had to include dir on line 45
for e in ['src', 'etc/linuxcnc', '/etc/linuxcnc', 'share/linuxcnc']:
to
for e in ['../src','src', 'etc/linuxcnc', '/etc/linuxcnc', 'share/linuxcnc']:
if someone can commit it ?
Attachments:
The following user(s) said Thank You: tommylight, COFHAL
Please Log in or Create an account to join the conversation.
14 May 2024 02:04 - 14 May 2024 02:05 #300546
by COFHAL
Replied by COFHAL on topic Mesa modbus and pktUart
I already have MESA MODBUS working, with one I control a VDF and with another an I/O card with 4 inputs and 4 outputs. The only problem is that from time to time this error appears, and fault error 11, both when I control the VFD and the I/O card. I have tried to change the modname.update-hz parameter to 0.1 but when doing so it appears that neither the VFD nor the I/O card receive the commands. According to the documentation for this component, this parameter can help when la, fault 11 appears,
Attachments:
Last edit: 14 May 2024 02:05 by COFHAL.
Please Log in or Create an account to join the conversation.
14 May 2024 02:36 #300548
by PCW
Replied by PCW on topic Mesa modbus and pktUart
That error (and others I have seen) seem to be a bug in the mesa-modbus code
The problem is that it does not reset the RX UART before using it, so if it has left over
RX data from the previous run. garbage from power cycles etc etc
Here's my list of know bugs, missing features:
Current Mesa Modbus issues:
BUGS:
At startup there can be "call/response function number missmatch"
error popups or sig11 (segv)s due to the fact that the PKTUART is
not cleared at startup, so random numbers of garbage characters
may be present in the RX FIFOs, leftover from the last LinuxCNC run.
A temporary workaround is to run this before launching linuxcnc:
mesaflash --device cardname --addr ipaddr --wpo 0x6800=0x00010000
(writing 0x10000 to 0x6800=pktuartr_mode_reg clears the RX FIFOs)
If you ever set the update rate to 0 (maximum), changing to a
non-zero rate will not work (communication stops)
There is a check for TX overflow in the PKTUART code that's
in the wrong location (TX section) so will print bogus error
messages with particular outgoing messages.
FEATURES:
Channel setting should not be global but in the .mod file
to support more than one device.
It would be good to have the error timeout/recovery
time programmable.
For multiple reads/writes it would be good to have the
possibility of mixed types,
This means for modbus devices that support table reads,
all I/O for a device could be done in a single read and a single
write.
The problem is that it does not reset the RX UART before using it, so if it has left over
RX data from the previous run. garbage from power cycles etc etc
Here's my list of know bugs, missing features:
Current Mesa Modbus issues:
BUGS:
At startup there can be "call/response function number missmatch"
error popups or sig11 (segv)s due to the fact that the PKTUART is
not cleared at startup, so random numbers of garbage characters
may be present in the RX FIFOs, leftover from the last LinuxCNC run.
A temporary workaround is to run this before launching linuxcnc:
mesaflash --device cardname --addr ipaddr --wpo 0x6800=0x00010000
(writing 0x10000 to 0x6800=pktuartr_mode_reg clears the RX FIFOs)
If you ever set the update rate to 0 (maximum), changing to a
non-zero rate will not work (communication stops)
There is a check for TX overflow in the PKTUART code that's
in the wrong location (TX section) so will print bogus error
messages with particular outgoing messages.
FEATURES:
Channel setting should not be global but in the .mod file
to support more than one device.
It would be good to have the error timeout/recovery
time programmable.
For multiple reads/writes it would be good to have the
possibility of mixed types,
This means for modbus devices that support table reads,
all I/O for a device could be done in a single read and a single
write.
Please Log in or Create an account to join the conversation.
Time to create page: 0.305 seconds