AnsweredAssumed Answered

ticket

Question asked by MING-WEI GAO on Apr 29, 2019
Latest reply on May 17, 2019 by Vlad Lionte

I have a problem about the baud rate of linflexd_uart in MPC5746R.

I set the baud rate at 9600 but i can't get the 9600 baud rate information in Oscilloscope.

I didn't know what's problem with this. Can you help me ?

I want to send the date by MPC5746R and  receive the date by the computer.

This is my code about uart.

 

int main(void)
{
/* Write your local variable definition here */

#define BUF_LEN 1U

uint8_t test_mode[BUF_LEN];
uint8_t rxBuff[BUF_LEN + 1];
uint16_t RX_ok = 0x23U;

 

/* Store configuration into structure */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
/* Change clock settings */
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
/* Initialize Pin Settings */
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
/* Initialize Uart */
LINFLEXD_UART_DRV_Init(INST_LINFLEXD_UART1, &linflexd_uart1_State, &linflexd_uart1_InitConfig0);
LINFLEXD_UART_DRV_Init(INST_LINFLEXD_UART2, &linflexd_uart2_State, &linflexd_uart2_InitConfig0);

LINFLEXD_UART_DRV_SetBaudRate(INST_LINFLEXD_UART1,9600);
LINFLEXD_UART_DRV_SetBaudRate(INST_LINFLEXD_UART2,9600);
while(1) {


// LINFLEXD_UART_DRV_ReceiveDataBlocking(INST_LINFLEXD_UART1, (uint8_t*)rxBuff, BUF_LEN, 300U);

// test_mode[0]=rxBuff[0]+1;
test_mode[0]=0x61;


// LINFLEXD_UART_DRV_SendDataBlocking(INST_LINFLEXD_UART2,(uint8_t*)test_mode, BUF_LEN,300U);
LINFLEXD_UART_DRV_SendData(INST_LINFLEXD_UART2, (uint8_t*)test_mode, BUF_LEN);
// if ( rxBuff[0] == 1)
// {
// RX_ok = 1;
// }
}

 

My rose =0 , LINIBRR = 0x068 (Hex) = 104 d ,LIN_clk = 16Mhz.

baud rate = 16M/(16*104) = 9615 bit/s.

the width of date is 16.8us but 9600 baud rate is 104us.

Attachments

Outcomes