Jump to content
  • 0

pmod esp32


elAmericano

Question

Hello,

I am working with Artix A7 board, implementing various PMODs successfully.  I am having some issue with PMOD-ESP32 unfortunately.

The source files from a project off github (ESP32.c/ESP32.h) from https://github.com/mitchellorsucci/PMODESP32 as well as the included libraries (PmodESP32.c/PmodESP32.h)

GitHub Project:

I believe the following macros need to be re-defined in the ESP32.h file from github, however in XILINX project for Artix A7, there is a uart-lite that is connected via AXI and there is a uart connected to the ESP32 IP.  I have tried to define both.  When I define this as the uart-lite device ID, I get some output on console, but I cannot successfully connect to WIFI (which makes me believe the AT commands are being sent to AXI-UART , but not to ESP32 device uart).   When I define uart_device as ESP device, nothing prints to console terminal.    Please let me know if you have any suggestion.

  1. #define UARTLITE_DEVICE_ID XPAR_UARTLITE_1_DEVICE_ID
  2. #define INTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID
  3. #define UARTLITE_INT_IRQ_ID XPAR_INTC_0_UARTLITE_1_VEC_ID

 

When I try to use the PmodESP32.h / PmodESP32.c included with IP, I am also not able to succesfully communicate with device.  I basically do the following

  1. ESP32_HardwareEnable(ESP32);
  2. ESP32_Initialize(ESP32, u32 UartBaseAddr, u32 GpioBaseAddr);
  3. ESP32_HardwareReset(ESP32);
  4. ESP32_SendBuffer(ESP32, u8 *buffer, u32 count);

The commands i try to send are for connecting to WIFI and for configuring TCP, the functions return 0, which i understand means not succesful. I have reconfigure some of the functions from the github project to work with PmodESP32.c/PmodESP32.h files (the github project uses a UART only devicePtr, whereas the included PmodESP32 files have GPIO / UART structure).  

 

int set_wifi_mode(PmodESP32 * devicePtr, unsigned int mode) {
    u8 tx_buf[50];
    if(mode > 3) {
        xil_printf("Mode %d is not supported for setting the WiFi mode\n\r");
        xil_printf("Please Use Modes:\n\r");
        xil_printf("\tNULL_MODE\n\r\tSTATION_MODE\n\r\tSOFTAP_MODE or\n\r\tSOFTAP_AND_STATION_MODE\n\r");
        return XST_FAILURE;
    }
    sprintf(tx_buf, "AT+CWMODE=%d", mode);
    ESP32_SendBuffer(devicePtr, tx_buf, strlen(tx_buf));
    send_n_clr(devicePtr);
    return XST_SUCCESS;
}

int get_current_AP(PmodESP32 * devicePtr) {
    u8 tx[] = "AT+CWJAP?";
    ESP32_SendBuffer(devicePtr, tx, strlen(tx));
    send_n_clr(devicePtr);
    return XST_SUCCESS;
}

int set_current_AP(PmodESP32 * devicePtr, char * ssid, char * pwd, char * bssid) {
    u8 tx_buf[100];
    sprintf(tx_buf, "AT+CWJAP=\"%s\",\"%s\"", ssid, pwd);
    if(bssid != NULL) {
        int cursor = strlen(tx_buf);
        sprintf(tx_buf + cursor, ",\"%s\"");
    }
    ESP32_SendBuffer(devicePtr, tx_buf, strlen(tx_buf));
    sendNLCR(devicePtr);
    return XST_SUCCESS;
}


int list_available_APs(PmodESP32 * devicePtr, char * ssid) {
    u8 tx_buf[100];
    sprintf(tx_buf, "AT+CWLAP");
    if(ssid != NULL) {
        int cursor = strlen(tx_buf);
        sprintf(tx_buf + cursor, "=\"%s\"", ssid);
    }
    ESP32_SendBuffer(devicePtr, tx_buf, strlen(tx_buf));
    sendNLCR(devicePtr);
    return XST_SUCCESS;
}
 

 

ESP32.c ESP32.h PmodESP32.c PmodESP32.h

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Hello @elAmericano,

I didn't have the time to look into the source code, but you should use the already working project for Arty which I found here: https://github.com/mitchellorsucci/ArtyS7PmodESP32

You should change the constrains in the xdc file and the board in the project summary.

Also other info is here: https://www.hackster.io/morsucci/wireless-fpga-debugger-and-system-monitor-56b7e5

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...