Problems handling framing errors and SCI

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problems handling framing errors and SCI

ソリューションへジャンプ
1,641件の閲覧回数
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 件の賞賛
返信
1 解決策
1,319件の閲覧回数
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 件の賞賛
返信
1 返信
1,320件の閲覧回数
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 件の賞賛
返信