PSOC4 SCB UART loses characters

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DoLo_351801
Level 3
Level 3
10 replies posted 10 questions asked 10 sign-ins

I am losing characters during transmit and receive. I want to try increasing the buffer size for tx and rx.

Using  2 psoc4 SCBs configured as UARTs.  One goes to the PC as a log the other goes to a SIM 7600A GSM modem. I am losing characters transmitting to the GSM modem. I think it might be the buffer size is too small.

I would like to increase the tx and rx buffers.  I’m using SCB UART, with interrupt “RXFIFO not empty”. I started with an external interrupt with buffer size 8 for both rx and tx. It works for short commands to the modem.

Issues:

  • Increasing the tx buffer size required me to use an internal interrupt.  OK, I changed the external to internal, and it seems to work. But I still have problems
  • Increasing the rx buffer size requires the option of rx fifo not empty.  But I cannot get it to work.

2 UARTS

  1. UART_CMD (to the PC)   
    1. Uses default buffer sizes tx 8 and rx 8
    2. Uses external interrupt
  2. UART_GSM (to the GSM modem)
    1. Trying to increase the buffer size for both rx and tx
    2. Uses internal interrupt that was required by increasing the Tx buffer size

I am allowing PSOC creator to configure the pins.

I am using a cy8ckit-042

Initialization:

    ISR_CMD_ClearPending() ;

    ISR_CMD_StartEx(ISR_CMD_Handler) ;

    UART_GSM_SetCustomInterruptHandler(*ISR_GSM_Handler);

    UART_GSM_ClearRxInterruptSource(UART_GSM_INTR_RX_NOT_EMPTY) ;

    UART_CMD_Start() ;

    UART_GSM_Start() ;

    CyGlobalIntEnable; /* Enable global interrupts. */   

Simple rx interrupt routine.

if (UART_CMD_SpiUartGetRxBufferSize()) {   // changed if to while

        cmd_buf[cmd_write_index] = UART_CMD_UartGetByte() ;

        cmd_write_index = (cmd_write_index + 1) % RX_BUF_LEN ;

    }

    UART_CMD_ClearRxInterruptSource(UART_CMD_INTR_RX_NOT_EMPTY) ;

 

Is it possible to receive more than one character during an interrupt cycle? If so, I could change the if to while.

What else could I be doing wrong?

0 Likes
1 Reply
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello Doug.

Can you attach the project.

Also, I'm confused where the problem is located.  You mention loosing characters towards the GSM modem, but you show rx interrupt routine.  Do you mean to say, chars are being lost on reception from PC?

Can you try a loopback in s/w for the UART connected to PC.  Need to get each UART working independently first.

BTW, how do you determine the location that chars are being lost?  Do you have oscilloscope for monitoring?

0 Likes