I have a USB->Serial device connected to my PC and I would like to use the Simulator to talk to it. I have the following simple task setup:
void fnApplication(TTASKTABLE *pTable)
{
//initialize
if( state == 0 )
{
TTYTABLE tInterfaceParameters; //table for passing information to driver
tInterfaceParameters.Channel = DEMO_UART; // serial 0, 1, 2, 3, 4, etc.
tInterfaceParameters.ucSpeed = SERIAL_BAUD_115200; // baud rate
tInterfaceParameters.Rx_tx_sizes.RxQueueSize = RX_BUFFER_SIZE; // input buffer size
tInterfaceParameters.Rx_tx_sizes.TxQueueSize = TX_BUFFER_SIZE; // outpu buffer size
tInterfaceParameters.Task_to_wake = 0;
tInterfaceParameters.usConfig = (CHAR_8 | NO_PARITY | ONE_STOP | RTS_CTS | NO_HANDSHAKE | CHAR_MODE);
if ( (SerialPortID = fnOpen(TYPE_TTY, FOR_I_O, &tInterfaceParameters)) != 0 ) // open or change the channel with defined configurations (initially inactive)
{
fnDriver( SerialPortID, (RX_ON | TX_ON), 0 ); // enable RX & TX
DebugHandle = SerialPortID;
state = 1;
}
}
else
{
int count = fnMsgs(SerialPortID);
if( count > 0 )
{
unsigned char buffer[MEDIUM_MESSAGE];
int read;
read = fnRead(SerialPortID,buffer,MEDIUM_MESSAGE);
}
}
}
Also, I have #define SERIAL_PORT_0 '8' set in app_hw_m5223x.h
If I reset the device connected to the USB->Serial connection, it sends some data on bootup. If I connect to COM8 with Hyperterminal, I can see this data come in. However, the above task never gets a value from fnMsgs() greater than zero.
Am I missing some step to get the Simulators serial emulation to work?