Problem using UART with ADuCM4050

Hi team,

I've been working with ADuCM3029 until a few weeks and I'm using an ADuCM4050 microcontroller right now in a embedded system. Some APIs/drivers are different between them, so I had to update the firmware modifying some functions. However, I found a problem with UART, which cannot transmit data through serial port, (for example, printf() doesn't print anything), even using the internal loopback function I don't get the correct results. My team checked the hardware and it seems everything is OK, so maybe I have something wrong in my code and I can't find it.

The UART init looks like this:

uint8_t USBconnected;
uint8_t recBuffer;
void uart_Callback(void *pCBParam, uint32_t Event, void *pArg)
{
  switch(Event)
  {
    case ADI_UART_EVENT_RX_BUFFER_PROCESSED:
      if(USBconnected)
      {
        adi_uart_SubmitRxBuffer(hDevOutput,&recBuffer,1,true);
      }
      else
      {
        adi_uart_SubmitRxBuffer(hDevOutput,(void*)&uartBuffer,sizeof(UARTRecStruct),true);
        *((bool_t*)pCBParam)=true;
      }

      break;
      
    //Set TX as default
    default:
      if(USBconnected)
      {
        adi_uart_SubmitTxBuffer(hDevOutput,&recBuffer,1,true);
      }
      else
      {
        adi_uart_SubmitTxBuffer(hDevOutput,(void*)&uartBuffer,sizeof(UARTRecStruct),true);
        *((bool_t*)pCBParam)=true;
      }

      break;
  }
}


void UART_init(uint32_t *breakSleep)
{
    /* Set the pinmux for the UART */
    *pREG_GPIO0_CFG |= UART0_TX_PORTP0_MUX | UART0_RX_PORTP0_MUX;

    /* Open the UART device.Data transfer is bidirectional with NORMAL mode by default. */
    if(adi_uart_Open(0u, ADI_UART_DIR_BIDIRECTION, OutDeviceMem, sizeof OutDeviceMem, &hDevOutput)!=ADI_UART_SUCCESS)
        printf("adi_uart_Open failed\n");

    /* Set UART to 115200 */
    if(adi_uart_ConfigBaudRate(hDevOutput, UART_DIV_C, UART_DIV_M, UART_DIV_N,UART_OSR)!=ADI_UART_SUCCESS)
        printf("adi_uart_ConfigBaudRate failed\n");
    
    if(adi_uart_RegisterCallback(hDevOutput,uart_Callback,breakSleep)!=ADI_UART_SUCCESS)
        printf("adi_uart_RegisterCallback failed\n");
}

The main function starts with System, UART, I2C and SPI initialization followed by a while(1) loop with a printf("hello\n");.

Thank you all for your attention.

Regards.

Parents Reply Children
No Data