Mesa modbus and pktUart

More
3 years 1 month ago #280227 by Donno
Replied by Donno on topic Mesa modbus and pktUart
YES !



Thanks for the help PCW ! I will carry on tomorrow and start working on the errors and make the update rate faster. Once done i will give feedback and ask few questions that i am not sure of.

Please Log in to join the conversation.

More
3 years 1 month ago #280247 by Donno
Replied by Donno on topic Mesa modbus and pktUart
After re-write of driver everything works as expected :
Code:
// 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"} };

 

Attachment not found



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.

 

Attachment not found



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
Code:
for e in ['src', 'etc/linuxcnc', '/etc/linuxcnc', 'share/linuxcnc']:

to
Code:
for e in ['../src','src', 'etc/linuxcnc', '/etc/linuxcnc', 'share/linuxcnc']:

if someone can commit it ?





 

Please Log in to join the conversation.

More
2 years 5 months ago #300546 by COFHAL
Replied by COFHAL on topic Mesa modbus and pktUart
 

Attachment not found

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,

Please Log in to join the conversation.

More
2 years 5 months ago #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.


 

Please Log in to join the conversation.

More
1 year 9 months ago #318551 by vre
Replied by vre on topic Mesa modbus and pktUart
How can i use PKTUART with 7i80hd?
Include smartserial funtion in bitfile and use a ttl to rs485 converter module?

Please Log in to join the conversation.

More
1 year 9 months ago #318556 by PCW
Replied by PCW on topic Mesa modbus and pktUart
You can add a PktUART to any Mesa (or other hostmot2) card
Its not the same as SmartSerial. To use Mesa Modbus you must
have a RS-485 interface (with RX,TX, and TXEN pins on the FPGA side)
 

Please Log in to join the conversation.

More
1 year 9 months ago #318596 by vre
Replied by vre on topic Mesa modbus and pktUart
What module must include to PIN file PktUARTTTag ?
like this
Code:
(PktUARTTTag, x"00", ClockLowTag, x"08", PktUARTTDataAddr&PadT, PktUARTTNumRegs, x"00", PktUARTTMPBitMask), IOPortTag & x"00" & PktUARTTTag & PktUTDataPin, IOPortTag & x"00" & PktUARTTTag & PktUTDrvEnPin,

Something else?
What is PktUARTRTag receive and PktUARTTTag transmit ?

Please Log in to join the conversation.

More
1 year 9 months ago #318599 by PCW
Replied by PCW on topic Mesa modbus and pktUart
Here's an example working pinout file with a PktUART

 

Attachment not found



You should be able to cut/paste into your actual pinout file

You need both the:
      
        PktUARTTTag   
        PktUARTRTag    

Note that the

PktUTDrvEnPin is active low, if you need active high, use PktUTNDrvEnPin

        IOPortTag & x"00" & PktUARTRTag & PktURDataPin,      -- I/O 30   RX PKTUART PIN
        IOPortTag & x"00" & PktUARTTTag & PktUTDataPin,      -- I/O 31   TX PKTUART PIN
        IOPortTag & x"00" & PktUARTTTag & PktUTDrvEnPin,    -- I/O 32   TX PKTUART PIN



 

Please Log in to join the conversation.

More
1 year 9 months ago #318674 by vre
Replied by vre on topic Mesa modbus and pktUart
With this config for mb2hal i have a working system
Code:
[TRANSACTION_00] LINK_TYPE=serial SERIAL_PORT=/dev/ttyS0 SERIAL_BAUD=19200 SERIAL_BITS=8 SERIAL_PARITY=none SERIAL_STOP=1 SERIAL_DELAY_MS=5 MB_SLAVE_ID=1 #address here is in DEC base FIRST_ELEMENT=129 PIN_NAMES=01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16 HAL_TX_NAME=in MB_TX_CODE=fnct_03_read_holding_registers [TRANSACTION_01] PIN_NAMES=01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16 MB_TX_CODE=fnct_16_write_multiple_registers #address here is in DEC base FIRST_ELEMENT=1 HAL_TX_NAME=out MAX_UPDATE_RATE=0.0

And i have this config for mesa modbus.
Is that correct ?
Code:
#define MAX_MSG_LEN 16 // may be increased if necessary to max 251 static const hm2_modbus_chan_descriptor_t channels[] = { /* {TYPE, FUNC, ADDR, COUNT, pin_name} */ {HAL_S32, 3, 0x0081, 0x07, "in"}, {HAL_S32, 16, 0x0001, 0x07, "out"}, };

Please Log in to join the conversation.

More
1 year 9 months ago #318681 by PCW
Replied by PCW on topic Mesa modbus and pktUart
Not sure. what device are you interfacing?
Do you really have 7 input and 7 output registers with integer values?

Please Log in to join the conversation.

Time to create page: 0.247 seconds
Powered by Kunena Forum