Error on first UART output during initialisation

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

cross mob
Bigby
Level 2
Level 2
25 sign-ins 10 sign-ins 5 replies posted

Hello everybody,

I encountered some strange behaviour using UART.

I'm developing on a CY8C4126AXI-S445. I needed some debug outputs, so I decided to use a UART bridge project, which has already worked before.

As a bridge I use a CY8CKIT-059. It has a UART_in and a UART_out.
this is the entire user code in main.c:

int main(void)
{
  CyGlobalIntEnable; /* Enable global interrupts. */
  UART_in_Start();
  UART_out_Start();

  uint8_t uartChar;

  for(;;)
  {
    /* Place your application code here. */
    uartChar = UART_in_GetChar();
    if(uartChar)
    {
      UART_out_PutChar(uartChar);
    }
  }
}

However the problem seems to be in the CY8C4126AXi-S445.
I wanted to put out "Initialisation\r\n" during initialisation.
Put what I saw on my terminal was something like this: Initia[][][]\r\n

I tried different Texts and depending on the length the rectangles appeared at different spots. I tried changing several UART parameters like baud rate, oversampling etc. All with pretty much the same result.

I added texts and noticed that this error only occurs on the first output command.

I also noticed, when I put the command into the main loop, there is no error. So it only happens during initialisation. Has anyone else observed this behaviour before? Has anyone a solution to this problem?

Thanks for your help.
Please let me know if you need any project files.

0 Likes
2 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

Can you make sure that both the device and bridge have common ground. When you say you are facing the problem during initialization, what all are being done during the initialization ?

Best Regards,
Vasanth

0 Likes
Bigby
Level 2
Level 2
25 sign-ins 10 sign-ins 5 replies posted

Hello Vasanth,

thanks for your reply.
the grounds of the boards are connected (J1, Pin25 on theCY8CKIT-059 to VSSD, Pin17 on CY8C4126AXI-S445)

This is the initially used initialization code:

CyGlobalIntEnable; /* Enable global interrupts. */
Em_EEPROM_Init(EE_ADDR);
UART_DBG_Start();
int i = 0;
UART_DBG_UartPutString("Initialisation\r\n");

const char bla[] = {0x12, 0x34, 0x56, 0x78};
const char bla2[] = {0x90, 0xAB, 0xCD, 0xEF};
const char read[4];

Em_EEPROM_Read(0, (void*)read, 4);
for(int i = 0; i < 4; i++)
{
    UART_DBG_UartPutChar(read[i]);
}
if(read[0] == 0x90)
{
    Em_EEPROM_Write(0,(void*)bla, 4);
}
else
{
    Em_EEPROM_Write(0,(void*)bla2, 4);
}

0 Likes