Migrating from SiLabs/BlueGiga BGAPI - Questions on AT firmware

madsci
Posts: 3
Joined: Wed Oct 20, 2021 2:34 am

Migrating from SiLabs/BlueGiga BGAPI - Questions on AT firmware

Postby madsci » Wed Oct 20, 2021 3:06 am

tl;dr: Is there a binary equivalent of the AT command set? By which I mean one that doesn't use plain ASCII text but rather a consistent binary format?

I've been using the SiLabs WGM110 for years. It was derived from the BlueGiga WF121 and uses the same binary BGAPI interface. I'd looked at the ESP8266 when I was choosing a WiFi module, but at the time it just didn't seem mature enough.

Now, the WGM110 is getting toward its end of life, the chip shortage has made it completely unavailable, and SiLabs is going in a different direction for their new modules. I'm looking at moving to the ESP32.

From what I've read of the ESP32 AT command set, it looks like they have some broadly similar capabilities. The big difference is that BGAPI uses a very simple binary packet format for all of its commands, events, and responses. It's not terribly well documented, but at least it's consistent. I've written a driver / abstraction layer for my host MCU that gets very good throughput and low latency out of the UART link, and provides something like the Berkeley Sockets API for the application.

I think I can make things work with the AT command set, but it looks like it's going to mean extra complexity and probably a significant performance hit for the driver to have to parse variable-length text fields.

Has anyone come up with a binary serial command format for the ESP32 that would provide the same capabilities but in a more concise and uniform way? If not, can anyone familiar with the internals of ESP-AT comment on how difficult that might be to do? I'm just starting to dig into the code and haven't figured out how it's all structured yet.

Also, can anyone comment on the real-world performance of ESP-AT running multiple TCP/UDP connections? My application usually has several sockets open at a time. Usually raw bandwidth isn't a major concern but it needs to handle concurrency well.

Apologies if this stuff is covered somewhere. I think it's great that the hobbyist community has embraced the ESP32 so thoroughly but at the same time it makes the signal-to-noise ratio in Google searches pretty bad sometimes.

Thanks!

justind000
Posts: 3
Joined: Fri Oct 15, 2021 12:46 am

Re: Migrating from SiLabs/BlueGiga BGAPI - Questions on AT firmware

Postby justind000 » Wed Oct 20, 2021 1:02 pm

I'm a bit like you, new to the ESP-AT project. I'm not sure if you have seen the SPI interface, but you can read about it https://docs.espressif.com/projects/esp ... PI_AT.html. I am not familiar with BGAPI so I can't say how it compares. It works in a similar way to https://www.adafruit.com/product/4201 and also https://github.com/arduino/nina-fw. I can't give my experience with the SPI interface as I haven't used it, just noticed it in the documentation.

Hopefully what you need is easily accessed in the distributed firmware from Espressif. I have had a lot of compilation issues trying to compile a custom firmware, mostly in regards to anything with bluetooth. So in regards to your other question of use-experience, I have not been able to move forward yet.

madsci
Posts: 3
Joined: Wed Oct 20, 2021 2:34 am

Re: Migrating from SiLabs/BlueGiga BGAPI - Questions on AT firmware

Postby madsci » Fri Oct 22, 2021 5:19 pm

If I'm understanding this right, the SPI interface just provides a transport for the same AT command set and responses. In my particular case it would be worse than the UART interface - just as difficult to parse, probably harder to set up DMA for, and since I've only got one SPI interface available and it's already busy much of the time it'd cause some major headaches with meeting task deadlines.

ESP_Alson
Posts: 106
Joined: Mon Mar 22, 2021 3:37 am

Re: Migrating from SiLabs/BlueGiga BGAPI - Questions on AT firmware

Postby ESP_Alson » Thu Dec 30, 2021 7:02 am

Hello, I don't quite understand what you mean. Could you describe the problem in detail?

For AT communicate over SPI, you can refer to https://docs.espressif.com/projects/esp ... PI_AT.html.

madsci
Posts: 3
Joined: Wed Oct 20, 2021 2:34 am

Re: Migrating from SiLabs/BlueGiga BGAPI - Questions on AT firmware

Postby madsci » Mon Jan 03, 2022 10:27 pm

ESP_Alson wrote:
Thu Dec 30, 2021 7:02 am
Hello, I don't quite understand what you mean. Could you describe the problem in detail?

For AT communicate over SPI, you can refer to https://docs.espressif.com/projects/esp ... PI_AT.html.
Hi,

Maybe it would be best if I explained how it works now with the SiLabs module. The SiLabs WGM110 uses the BlueGiga API (BGAPI) for the host to network co-processor connection. All messages between the host and the NCP are in BGAPI's binary packet format. Every packet has a simple 4-byte header, and some packet types also include a variable-length body. The length is indicated in the header.

The BGAPI packets handle all of the things that your AT command set does, like setting up access point mode, or sending and receiving socket data. It's much more efficient to process than text AT commands, though. The host's DMA controller can generate an interrupt immediately with each packet because it knows each packet will start with 4 bytes, and it's very easy to parse the binary packets.

To switch to a text AT command format will require a lot more parsing and converting numeric data types. It'll require either significantly more interrupts or will cause increased latency. I was hoping that maybe there was some API available that mirrored the functionality of the AT command set but in a more efficient binary form.

Thanks,

Scott

ESP_Sun
Posts: 288
Joined: Thu Dec 30, 2021 9:52 am

Re: Migrating from SiLabs/BlueGiga BGAPI - Questions on AT firmware

Postby ESP_Sun » Tue Jan 04, 2022 3:27 am

Hi,

If I understand your idea correctly, AT currently does not have such an API.

maybe you can modify https://github.com/espressif/esp-at/blo ... art_task.c# L97 at_port_write_data and at_port_read_data Function to achieve the effect you want.

Who is online

Users browsing this forum: No registered users and 10 guests