Problem with communicating with serial terminal

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Problem with communicating with serial terminal

    I work with embOS V3.60 .with lpc 2458
    I m using UART1 to serial communication with my PC.

    When I Use EmbOsview I can send and receive data from this uart.
    But unfortunately EmbOsview is not the best serial terminal to send data, such a script. I had tried to use Tera Term for this propose but I can only receive data from my system.Is any buddy can tell me what shall I do to fix this problem.
  • I moved this thread to "embOS related".


    Please be aware if you use embOSView and OS functions like OS_SendString() also some protocol bytes are send by embOS.

    So for example if you call

    C Source Code

    1. OS_SendString("Hello")


    you will receive at PC side not only "Hello" but also some protocol bytes. These protocol bytes are necessary for the communication with embOSView.

    You can hook your own serial functions if you want to use embOSView. If you want to use serial communication w/o embOSView and the protocol you have to write your own uart handlers.
  • Thank you for your response Yes i use OS_SendString() and I know emboss transmit some protocol bytes.
    But what about receiving parts

    what’s happening her. What Embosview do to communicate with Embos?
    When I use Tera term I can se I receive something in _OS_COM_ISR(void) but when it processing the received byte it OS_OnRx(_OS_UART_RBR) nothing hapends.
    When you say I have to write my one uart handler du you means that I have to change this part of RTOSINIT file ?




    [
    /****** Assign UART sfrs used for OSView communication ***********/
    #if OS_UART_USED #if (OS_UART == 0) #define _OS_UART_BASE_ADDR (_UART0_BASE_ADDR)
    #define _OS_UART_INT_INDEX (6)

    #define _UART_PCONP_BIT (3)

    #define _OS_UART_PINSEL_RX _PINSEL0

    #define _OS_UART_PINSEL_TX _PINSEL0

    #define _PINSEL_UART_MODE_RX_POS (6)

    #define _PINSEL_UART_MODE_TX_POS (4)

    #define _PINSEL_UART_MODE_RX_VAL (1)

    #define _PINSEL_UART_MODE_TX_VAL (1)

    #elif (OS_UART == 1)
    #define _OS_UART_BASE_ADDR (_UART1_BASE_ADDR)
    #define _OS_UART_INT_INDEX (7)

    #define _UART_PCONP_BIT (4)

    #define _OS_UART_PINSEL_RX _PINSEL7

    #define _OS_UART_PINSEL_TX _PINSEL7

    #define _PINSEL_UART_MODE_RX_POS (2)

    #define _PINSEL_UART_MODE_TX_POS (0)

    #define _PINSEL_UART_MODE_RX_VAL (3)

    #define _PINSEL_UART_MODE_TX_VAL (3)

    #endif

    #define _OS_UART_RBR *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_RBR_OFFS)

    #define _OS_UART_THR *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_THR_OFFS)

    #define _OS_UART_IER *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_IER_OFFS)

    #define _OS_UART_IIR *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_IIR_OFFS)

    #define _OS_UART_FCR *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_FCR_OFFS)

    #define _OS_UART_LCR *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_LCR_OFFS)

    #define _OS_UART_LSR *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_LSR_OFFS)

    #define _OS_UART_SCR *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_SCR_OFFS)

    #define _OS_UART_DLL *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_DLL_OFFS)
    #define _OS_UART_DLM *(volatile OS_U8*)(_OS_UART_BASE_ADDR + _UART_DLM_OFFS) #define _RX_FULL_INT_ENABLE_BIT 0 #define _TX_EMPTY_INT_ENABLE_BIT 1 #define _RX_ERROR_INT_ENABLE_BIT 2 #define _INT_PENDING_BIT 0 #define _UART_INT_MASK 0x0E #define _UART_ERROR_INT_STATUS 0x06 #define _UART_RX_INT_STATUS 0x04 #define _UART_TX_INT_STATUS 0x02#endif /* OS_UART_USED */
    ]



    and

    And _OS_COM_ISR(void)
  • Ok, let me explain it a little bit more in detail :) .

    embOS does no communication on its own, only when embOSView sends a complete protocol string, embOS will answer in the same protocol format.

    So what happens:
    1. embOSView sends a protocol over uart to your target.
    2. embOS receives byte per byte in ther uart rx interrupt handler and calls every time OS_OnRx()
    3. OS_OnRx() calls a state machine, which checks if a complete protocol is received.
    4. As soon as a complete protocol is received embOS sends a response to embOSView

    If you don not want to use profiling with embOSView but want to use your own serial communication please do the following:
    1. Use your terminal program instead of embOSView
    2. Keep the uart initialization OS_COM_Init() as it is in Rtosinit.c
    3. Modify the Rx and Tx interrupt routine to handle the sent and received bytes.
    4. Write your own function to send one or several bytes over the uart.

    Basically there is no difference between programning your uart communication with embOS or w/o an OS. The only difference is here that you can use our uart initialization and you have to call OS_EnterInterrupt()/ OS_LeaveInterrupt() in the uart interrupt routine.