Rust Particle Argon Wifi AT Commands

Hello,

i am trying to implement WiFi for the Particle Argon in Rust.

I think the esp32 chip is connected via uart to the nrf52. (https://docs.particle.io/assets/images/argon/argon-block-diagram.png) but am not 100% sure.

I tried reverse engineer the cpp code (device-os/esp32_ncp_client.cpp at develop · particle-iot/device-os · GitHub) but could not get a response from the esp32 when i send an AT command there is no response. (Basic AT Commands — ESP-AT User Guide documentation) I just sent a basic “AT\r\n” but get no response.

For uart i used the pins from the layout. I tried to use the rts/cts pins manually and with the provide nrf52 uarte hal.
For the baudrate i used 921600.

Before i started the transmission i set wifi_en and boot_mode high. (I got this from the cpp file)

As of now i tried a lot of different parameters but cannot get a response from the esp32. I tried uart with an external device and sending and receiving data works fine there.

Regards
Sebastian

Can you show your code?
Serial1 is not the UART you’d use to talk to the NCP.

However, it would be a nice feature request to implement a WiFi.command() API à la Cellular.command()

Here is the rust code. (Just test code at the moment)

I thought it would be serial as it is initialized here:

Hi,

I kind of have the same issue trying to bootstrap the communication. It seems @heusini uses the proper pins, is it maybe that the UARTE is not capable of directly speaking to them?

Cheers

This is the code I used to test communicating with the ESP32 from Device OS. I was able to send AT commands and get responses with this.

    // Disable ESP32. It appears to be turned on by default even in SEMI_AUTOMATIC mode
    WiFi.off();
    delay(5000);

    // Enable ESP32
    _log.trace("rebooting ESP32");

    pinMode(ESPBOOT, OUTPUT);
    pinMode(ESPEN, OUTPUT_OPEN_DRAIN);
    digitalWrite(ESPBOOT, 1);
    delay(100);
    digitalWrite(ESPEN, 0);
    delay(100);
    digitalWrite(ESPEN, 1);
    delay(100);

    // Set up serial
    _log.trace("Starting serial");
    Serial2.begin(921600, SERIAL_FLOW_CONTROL_RTS_CTS); // 115200
1 Like

Thanks for testing.
So if you do Serial2.write(“AT”); you get “Ok” when you do Serial2.read();

You do need an \r\n after the AT command because you need a line terminator, and the OK is uppercase, but yes. It might take a couple tries after rebooting the ESP32. I had a loop of up to 4 retries.

1 Like

Thanks for the help. I could fix it. I selected the wrong pins :man_facepalming:
I used P1.04 as TX and P1.05 as RX and so on. I marked the pins in the image so maybe it helps someone in the future :slight_smile: Such a silly mistake…
2021-03-31_10-54

2 Likes