AnsweredAssumed Answered

Some help with a simple UART program

Question asked by Vincent Kenbeek on Jul 16, 2019
Latest reply on Jul 16, 2019 by Mark Butcher

I have a FRDM-KL25Z connected to an ESP 01 through UART1.

The polling example provided with the SDK seems pretty simple, however when I adjust it to print the received data instead of echoing it, it prints the data I sent to the ESP 01 instead of the data I should have received from it.

My code look as follows:

uint8_t txbuff[] = "AT+GMR\r\n";
uint8_t rxbuff[20] = {0};

 

int main(void)
{
    uint8_t ch;
    uart_config_t config;

 

    BOARD_InitPins();
    BOARD_BootClockRUN();

 

    UART_GetDefaultConfig(&config);
    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
    config.enableTx = true;
    config.enableRx = true;

 

    UART_Init(DEMO_UART, &config, DEMO_UART_CLK_FREQ);


    UART_WriteBlocking(DEMO_UART, txbuff, sizeof(txbuff) - 1);
    UART_ReadBlocking(DEMO_UART, &rxbuff, 6);
    printf("%s\n", rxbuff);
}

The printf all the way at the bottom prints "AT+GMR" which is the string that I sent to the ESP 01.

The response should be something along the lines of "00170901".

How can I see what the response from the ESP 01?

Outcomes