Go Down

Topic: Is there an Arduino library, for ESP with at commands ? (Read 717 times) previous topic - next topic

x-giorgio-x

Hi

Is there an Arduino library, for ESP with at commands, compatible with the WiFi library ?
Or a good library ?
For zero.

WiFi class:
begin()
disconnect()
config()
setDNS()
SSID()
BSSID()
RSSI()
encryptionType()
scanNetworks()
status()
getSocket()
macAddress()

Juraj

there is only one such library for AT commands - WiFiEsp. but it is not made to be compatible with SAMD architecture

for example Teensy SAMD board users connect esp8266 over SPI and use WiFiSpiESP firmware and library. it is easier then with 5 V AVR boards because both boards are 3.3V, no level shifting is needed.

https://github.com/JiriBilek/WiFiSpiESP
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

x-giorgio-x

#2
Oct 09, 2018, 05:19 pm Last Edit: Oct 09, 2018, 05:20 pm by x-giorgio-x
This use SPI.
I need use UART RX and Tx and AT command.

pert

What is SAMD-incompatible about the WiFiEsp library? I haven't dug into the source very deeply but I can't imagine any of the code being architecture specific. The library.properties metadata claims it's compatible with all architectures.

x-giorgio-x

Code: [Select]

Arduino: 1.8.5 (Windows 10), Board: "GEVINO SAM-BA bootloader"

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp: In static member function 'static int EspDrv::sendCmd(const __FlashStringHelper*, int, ...)':

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1020:25: error: 'va_start' was not declared in this scope

  va_start (args, timeout);

                         ^

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1021:56: error: 'vsnprintf_P' was not declared in this scope

  vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);

                                                        ^

C:\Users\x-gio\Documents\Arduino\libraries\WiFiEsp\src\utility\EspDrv.cpp:1022:21: error: '__gnuc_va_end' was not declared in this scope

  __gnuc_va_end (args);

                     ^

exit status 1
Error compiling for board GEVINO SAM-BA bootloader.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Juraj

What is SAMD-incompatible about the WiFiEsp library? I haven't dug into the source very deeply but I can't imagine any of the code being architecture specific. The library.properties metadata claims it's compatible with all architectures.
RingBuffer exists in SAMD core and in WiFiEsp and implementation of functions with variable arguments length are not compatible with ARM compiler
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

pert

RingBuffer exists in SAMD core and in WiFiEsp
Since WiFiEsp uses the correct #include syntax, I don't see anything that would be problematic about that at a glance.

implementation of functions with variable arguments length are not compatible with ARM compiler
I noticed that from the error messages in the previous reply. I guess that needs C++11? It should be resolved by:
https://github.com/arduino/ArduinoCore-samd/issues/313
but there doesn't seem to be recent progress on that. It's kind of funny that the relatively modern SAMD boards are using a more outdated toolchain than the old school AVR.

Juraj

Since WiFiEsp uses the correct #include syntax, I don't see anything that would be problematic about that at a glance.

RingBuffer in SAMD core is a template class
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

x-giorgio-x

I have solved all the compilation issues this way, but it seems to not Work.

Changed RingBuff Class on RingBuffW
Added
#include <stdarg.h>
#include <stdio.h>
Changed
vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);
with
vsnprintf (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);

How is the equivalent of Vsnprintf_P with ARM ?

Juraj

I have solved all the compilation issues this way, but it seems to not Work.

Changed RingBuff Class on RingBuffW
Added
#include <stdarg.h>
#include <stdio.h>
Changed
vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);
with
vsnprintf (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);

How is the equivalent of Vsnprintf_P with ARM ?
ARM doesn't have PROGMEM, so no _P functions. use the version without _P
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

x-giorgio-x

This exactly my change.

Changed on RingBuffer.cpp & RingBuffer.h & EspDrv.cpp & EspDrv.h & Scketh
   RingBuff Class on RingBuffW
Added on EspDrv.cpp
   #include <stdarg.h>
Changed on EspDrv.cpp
   vsnprintf_P (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);
with
   vsnprintf (cmdBuf, CMD_BUFFER_SIZE, (char*)cmd, args);


But unit reboot each fiew seconds.
ESP led, blink repeatedly every few seconds, USB driver disappears and Returns.

Juraj

I hope you use Serial1 for esp8266, not the SerialUSB?
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

x-giorgio-x

Yes, I use Serial for ESP, SerialUSB for debug.



Code: [Select]

// use a ring buffer to increase speed and reduce memory allocation
RingBufferW buf(8);

void setup()
{
  Serial.begin(115200);       // initialize serial for ESP module
  SerialUSB.begin(115200);    // initialize serial for debugging
  WiFi.init(&Serial);         // initialize ESP module

x-giorgio-x

Ok, no, all Work Well.

Only small problem.
On USB debug Appears IP 0.0.0.0
But really work well at 192.168.1.1

Go Up