AnsweredAssumed Answered

MCUXpresso SDK and LPC824

Question asked by Yurii Korman on Jun 25, 2018
Latest reply on Jun 26, 2018 by jeremyzhou

Hello,

I have problem with transmit data by UART.

When I try transmit one byte, I see in debug mode how changed register TXDAT UART0 (0x4006401C). But recepient not get this data I use FTDI232 usb to ttl

 

My code:

usart_config_t user_config;

volatile uint32_t g_systickCounter;

void SysTick_Handler(void)
{
     if (g_systickCounter != 0U)
     {
         g_systickCounter--;
     }
}

void SysTick_DelayTicks(uint32_t n)
{
         g_systickCounter = n;
         while(g_systickCounter != 0U)
         {
         }
}

 

int main(void) {
      // /* Init board hardware. */
      BOARD_InitBootPins();
      BOARD_InitBootClocks();
      BOARD_InitBootPeripherals();
      // /* Init FSL debug console. */
      BOARD_InitDebugConsole();


      if(SysTick_Config(SystemCoreClock / 1000U))
      {
            while(1)
            {
            }
      }

      USART_GetDefaultConfig(&user_config);
      user_config.baudRate_Bps = 9600U;
      user_config.enableTx = true;
      user_config.enableRx = true;

      USART_Init(USART0, &user_config, DEFAULT_SYSTEM_CLOCK);

 

      uint8_t ch=65;

      while(1) {

             USART_WriteByte(USART0, ch);

             SysTick_DelayTicks(1000U);
       }
       return 0 ;
}

Pin init

 

void BOARD_InitPins(void)
{
       /* Enables clock for switch matrix.: 0x01u */
       CLOCK_EnableClock(kCLOCK_Swm);

       /* USART0_TXD connect to P0_4 */
       SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_4);

       /* USART0_RXD connect to P0_0 */
       SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_0);

       /* SWCLK connect to P0_3 */
       SWM_SetFixedPinSelect(SWM0, kSWM_SWCLK, true);

       /* SWDIO connect to P0_2 */
       SWM_SetFixedPinSelect(SWM0, kSWM_SWDIO, true);

        /* Disable clock for switch matrix. */
       CLOCK_DisableClock(kCLOCK_Swm);
}

When I wrong? 

Outcomes