I am using MQX 3.7 and CW10.1 on a MCF51JM. I have a serial communications handler that works for hours until the receiver gets hit with noise. When the receiver get a framing error the transmitter can not be enabled. I am not sure what is happening. My receive code
while ( fstatus(rs485_dev) ==TRUE ) {read(rs485_dev, &data, 1);
checks status and so does my tx code.
io=_io_ioctl( rs485_dev,IO_IOCTL_SERIAL_CAN_TRANSMIT, &io); if io == MQX_OK){ fwrite(&data, 1, 1, rs485_dev); }
I am not sure what to do next. Any suggestions?
1
Solved! Go to Solution.
Hi,
I'm not sure, but I think you're testing the return of "IO_IOCTL_SERIAL_CAN_TRANSMIT" incorrectly. If the serial is busy, "io_ioctl" also will return MQX_OK. Instead of assigning a return to "io", try the following:
_io_ioctl (rs485_dev, IO_IOCTL_SERIAL_CAN_TRANSMIT, & io);
if (io) {
fwrite (& data, 1, 1, rs485_dev);
}
Regards,
Tgomes
Hi,
I'm not sure, but I think you're testing the return of "IO_IOCTL_SERIAL_CAN_TRANSMIT" incorrectly. If the serial is busy, "io_ioctl" also will return MQX_OK. Instead of assigning a return to "io", try the following:
_io_ioctl (rs485_dev, IO_IOCTL_SERIAL_CAN_TRANSMIT, & io);
if (io) {
fwrite (& data, 1, 1, rs485_dev);
}
Regards,
Tgomes