Linux BSP v1.
Linux BSP v1.
Linux BSP v1.
Linux BSP v1.2
2
2
2....0
0
0
0 Development
Development
Development
Development Guide
Guide
Guide
Guide
41
5.9.3.
How to program VAB-600-E RS485 registries
If you need to program your own serial communication, please refer to
the following code to enable RS485 function:
#include <sys/ioctl.h>
#include "vizzini.h"
#include "vzioctl.h"
// uartfd: the serial file descriptor
// nIndex: the index of the RS485 device. (0 ~ 3)
void SetHalfDuplex_xr21V141x(int uartfd, int nIndex)
{
int nArgs[3] = {0};
nArgs[0] = UART_0_REG nIndex;
nArgs[1] = UART_FLOW;
ioctl(uartfd, VZIOC_GET_REG, &nArgs);
nArgs[0] = UART_0_REG nIndex;
nArgs[1] = UART_FLOW;
nArgs[2] |= UART_FLOW_HALF_DUPLEX;
ioctl(uartfd, VZIOC_SET_REG, &nArgs);
nArgs[0] = UART_0_REG nIndex;
nArgs[1] = UART_GPIO_MODE;
nArgs[2] = UART_GPIO_MODE_SEL_XCVR_EN_ACT |
UART_GPIO_MODE_XCVR_EN_POL;
ioctl(uartfd, VZIOC_SET_REG, &nArgs);
}
uartfd
uartfd
uartfd
uartfd
is the serial file descriptor you had opened,
nIndex
nIndex
nIndex
nIndex
is the index of the
RS485 device.
Please make sure to call SetHalfDuplex_xr21V141x() function every time after
configuring the serial setting as baud rate.