Mesa modbus and pktUart
- andypugh
- Offline
- Moderator
- Posts: 23538
- Thank you received: 4854
U32 seems wrong for a motor on-off signal. And are you sure that Modbus command 6 is correct?I did find that doc and have read it several times. I did also set a pin to control motor on/off (u32 IN 0x00000000 vfd_modbus.00.motor) but I did miss a pin.
I would expect the .mod file to have something like:
{HAL_BIT, 5, 0x2000, 1, "motor"}
Please Log in or Create an account to join the conversation.
- persei8
- Topic Author
- Offline
- Platinum Member
- Posts: 386
- Thank you received: 121
The docs state "In addition to the pins configured in the definition file, each module will create the following pins for each instance of the driver:"
I find that those HAL pins are not created. From the generated C file, I see there are a couple of conditions where the creation is skipped but don't know enough about it to figure out exactly why. There's something it doesn't like about retval in the rtapi_app_main function.
In my postgui HAL file, I instantiate the component with:
loadrt mesa_modbus ports=hm2_7i96.0.pktuart.0
addf mesa_modbus.00 servo-thread
Jim
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23538
- Thank you received: 4854
On the Huanyang GT series, to turn the motor on, you write 0x01 to register 0x1000. To turn it off, you write 0x05 to register 0x1000.
You might find this HAL component useful, in that case:
linuxcnc.org/docs/2.9/html/man/man9/enum.9.html
The docs state "In addition to the pins configured in the definition file, each module will create the following pins for each instance of the driver:"
I find that those HAL pins are not created.
fault and last-err should be created as pins. The others are parameters. These can still be "setp" to values but can't be netted. The manual page needs an update. you should see them with halcmd show param ?
There's something it doesn't like about retval in the rtapi_app_main function.
In that case it won't load at all?
Please Log in or Create an account to join the conversation.
- persei8
- Topic Author
- Offline
- Platinum Member
- Posts: 386
- Thank you received: 121
Why does the module want a motor pin when I set the motor on/off by writing a modbus register? What does it do?
Is the last-error pin an index to a list of error messages? If not, what is it?
Jim
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23538
- Thank you received: 4854
It seems that your Modbus driver doesn't really support that, so I think what you currently have it probably OK for the driver.
To send the 0x1 / 0x5 to the modbus driver you can either use the enum component I mentioned, (loadrt enum enums=E;;start;;;;stop should probably work) or maybe use a mux component if you prefer.
Are there any other values that can be sent to that register to do other things?
Please Log in or Create an account to join the conversation.
- persei8
- Topic Author
- Offline
- Platinum Member
- Posts: 386
- Thank you received: 121
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23538
- Thank you received: 4854
I am not sure what you mean by that. All that it does is convert HAL pins to Modbus messages and Modbus messages into HAL pins.I'm beginning to think this mesa_modbus component is intended to run as a standalone modbus vfd driver?
Which (along with the enum component) should be enough for most VFDs.
There is also the dedicated component for the HY GT VFD but that can't use the Mesa UART connection.
Please Log in or Create an account to join the conversation.
- persei8
- Topic Author
- Offline
- Platinum Member
- Posts: 386
- Thank you received: 121
Please Log in or Create an account to join the conversation.
- persei8
- Topic Author
- Offline
- Platinum Member
- Posts: 386
- Thank you received: 121
rtapi_app: caught signal 8 - dumping core
Jim
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
- Posts: 10711
- Thank you received: 3534
Shere your code
Please Log in or Create an account to join the conversation.