Hey guys,
I have a problem with the UART communication from Nucleo f401re to ESP-Wroom-32 (WiFi BLE Click wifi module mikroe). I’m able to send an AT command but not to receive. I’m using the latest mbed-os verion, also I’m sending the at command via the ATCmdParser Api that it’s included on the “mbed.h” file. I had tried to receive with the the recv() function but it returns False. I tried also with the BufferedSerial.h with the read() but nothinguuu. I’m positive that i’m sending the command because i tried to receive the response from the esp32 module with the samd21 dev board and i’m receiving it fine.
Here is the code:
"
#include “mbed.h”
#include
#define ESP32_DEFAULT_BAUD_RATE 115200
BufferedSerial _serial;
ATCmdParser _parser;
/////~ set the debug parameter as a true of the ATCmdParser ~////
using namespace std;
//static BufferedSerial pc(D1, D0, 115200);
//BufferedSerial serial(D10, D2, 115200);
//ATCmdParser at(&serial, “\r\n”);
char bufRead[100], buffWrite[50];
int main()
{
_serial = new BufferedSerial(D8, D2, ESP32_DEFAULT_BAUD_RATE);
_serial->set_format(
/* bits / 8,
/ parity / BufferedSerial::None,
/ stop bit */ 1
);
_parser = new ATCmdParser(_serial);
_parser->debug_on( 1 );
_parser->set_delimiter( “\r\n” );
bool result = false;
while(1){
_parser->send("AT");
int x = _serial->read(bufRead, 40);
printf("Response %s\n", bufRead);
printf("-> %d\n", x);
thread_sleep_for(2000);
}
}
"