This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data from serial line (or virutal com port) in simulation.

Hi,

I am using serial port in my project.
I want to use simulator on Windows PC with uVision IDE simulator running my application.
The input to application should be from UART.
I know that I can
1. Create simulation scripts.
2. Use the following:

MODE COM2 9600, 0, 8, 1
ASSIGN COM2 <S0IN >S0OUT
S0TIME = 1


to get the data from COM2.

COM2 is a virtual com port paired with other virtual com port (COM5).
Application (actually python), is supplying data to COM5.

This "almost" works. The data goes through. Unfortunatelly it is not reliable.
Some bytes are lost.

I have checked thoroughly that data is ok on COM5.

I am simulating LPC2378. The UART is handled in polling mode.
LPC application does not do anything else at this stage.

I know that interrupt based application would be better, next thing on my todo list,
but this should also work.

Doing some excersizes in simulator I discovered that it does work well only if there are programmed delays between character.
I wonder if this is not a solution. Intercept the data from COM in simulation and supply it char by char with programmed delays. Is it possible to get the data from serial in script function?

Regards
Hubert

Parents
  • Nikolay,

    I do not experience this problem using hyperterminal.
    I am pretty sure at this stage that the issue is between simulation thread, which runs in the background of uVission simulation. I was able to reproduce this case using only simulation function(signal) to supply data to uart. If there are no dealys it works the same way. If I don't introduce dealys in simulation the last byte (out of 16 sent) is received. There is a thread in this forum:
    µVISION DEBUGGER: AUTOMATED SERIAL INPUT SCRIPT
    which shows that there must be a delay between bytes.
    This is missing when mapping is done by ASSIGN function (IMHO).
    I agree with you that interrupt driven approach will not help in this case.
    I think I need to change approach and create dll which will receive data (e.g. over TCP/IP socket) and supply it to UART with the specified rate, i.e. no faster than at specified rate.

    Regards
    Hubert

Reply
  • Nikolay,

    I do not experience this problem using hyperterminal.
    I am pretty sure at this stage that the issue is between simulation thread, which runs in the background of uVission simulation. I was able to reproduce this case using only simulation function(signal) to supply data to uart. If there are no dealys it works the same way. If I don't introduce dealys in simulation the last byte (out of 16 sent) is received. There is a thread in this forum:
    µVISION DEBUGGER: AUTOMATED SERIAL INPUT SCRIPT
    which shows that there must be a delay between bytes.
    This is missing when mapping is done by ASSIGN function (IMHO).
    I agree with you that interrupt driven approach will not help in this case.
    I think I need to change approach and create dll which will receive data (e.g. over TCP/IP socket) and supply it to UART with the specified rate, i.e. no faster than at specified rate.

    Regards
    Hubert

Children
No data