Hi,
Is there any example of modbus for verdin?
I need to use modbus protocol in UART (RS485)
UART (Linux) | Toradex Developer Center
I used
ls -l /dev/verdin-uart*
stty -F /dev/verdin-uart1 115200
I tried with wrong pin
it is working now
Hi,
Is there any example of modbus for verdin?
I need to use modbus protocol in UART (RS485)
UART (Linux) | Toradex Developer Center
I used
stty -F /dev/verdin-uart1 115200
I tried with wrong pin
it is working now
Hi, Iâm the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
The context provided does not include specific information or examples about using the Modbus protocol with the Verdin iMX8M Plus. You may need to refer to additional resources or documentation specific to Modbus implementation on Torizon or the Verdin family.
Please, also check if these links can help you solve your problem:
Hello @khaled.hassan,
It is good to know you got this working, thanks for the update.
Best Regards,
Bruno
Hi I tried to use below code
#include <termios.h>
int main() {
struct termios tty;
int fd;
int flags = O_RDWR | O_NOCTTY | O_NONBLOCK;
fd = open("/dev/verdin-uart1", flags);
tcgetattr(fd, &tty);
tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;
tty.c_cflag |= B115200;
if (tcsetattr (fd, TCSANOW, &tty) != 0)
{
fprintf (stderr, "error %d from tcsetattr", errno);
return -1;
}
return 0;
}
But I am getting following error
=thread-group-added,id=âi1â GNU gdb (Debian 13.1-3) 13.1 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type âshow copyingâ and âshow warrantyâ for details. This GDB was configured as âaarch64-linux-gnuâ. Type âshow configurationâ for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type âhelpâ. Type âapropos wordâ to search for commands related to âwordâ. Warning: Debuggee TargetArchitecture not detected, assuming x86_64. =cmd-param-changed,param=âpaginationâ,value=âoffâ
[Thread debugging using libthread_db enabled]
Using host libthread_db library â/lib/aarch64-linux-gnu/libthread_db.so.1â.
Breakpoint 1, main () at /home/torizon/app/src/main.cpp:16
Loaded â/lib/ld-linux-aarch64.so.1â. Symbols loaded.
Loaded â/lib/aarch64-linux-gnu/libstdc++.so.6â. Symbols loaded.
Loaded â/lib/aarch64-linux-gnu/libc.so.6â. Symbols loaded.
Loaded â/lib/aarch64-linux-gnu/libm.so.6â. Symbols loaded.
Loaded â/lib/aarch64-linux-gnu/libgcc_s.so.1â. Symbols loaded.
[Inferior 1 (process 21) exited with code 0377]
The program â/home/torizon/app/modbusâ has exited with code 377 (0x00000179).
Hi it worked just needed to add below in docker-compose.yml
devices:
- â/dev/verdin-uart1:/dev/verdin-uart1â
Hello @khaled.hassan,
Thanks for the update.
You are correct, when using specific devices from the host system they need to be added to the container.
If you want to learn more about it, please see our pages about Peripheral Access on Torizon: Best Practices with Peripheral Access | Toradex Developer Center
Best Regards,
Bruno
Hi Bruno,
It just worked by normally after doing that change. Thanks.