Problems handling framing errors and SCI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems handling framing errors and SCI

Jump to solution
702 Views
barbercolman
Contributor III

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

 

 

 

 

0 Kudos
1 Solution
380 Views
Tgomes
Contributor III

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

View solution in original post

0 Kudos
1 Reply
381 Views
Tgomes
Contributor III

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

0 Kudos