i want to use a esp32 as wifi co processor for my stm32. the mcu are connected by spi and i try to send frames from the stm over the esp to a wifi client (pc with a java terminal) in th beginning its working fine and i get the frames correct but after a short time its stop sending.
I am finding that the ESP32 can stop working with WiFi if there are any brownout conditions. Make sure that you have plenty of current in your power to the ESP32.
#include <driver/spi_master.h>
#include "sdkconfig.h"
#include "esp_system.h" //This inclusion configures the peripherals in the ESP system.
////////////////////////////////////
//
//#define MAGTYPE true
//#define XGTYPE false
//////////////////////////
///////////////////////////
//
////////////////////////////
uint8_t GetLowBits();
uint16_t GetHighBits();
void fReadSPIdata16bits( spi_device_handle_t &h, int address );
int fWriteSPIdata8bits( spi_device_handle_t &h, int address, int sendData );
int fInitializeSPI_Devices( spi_device_handle_t &h, int csPin);
// spi_device_handle_t fInitializeSPI_Devices( int csPin);
int fInitializeSPI_Channel( int spiCLK, int spiMOSI, int spiMISO, spi_host_device_t SPI_Host, bool EnableDMA);
int fWriteSPIdata32bits( spi_device_handle_t &h, int _sendData0, int _sendData1, int _sendData2, int _sendData3 );
int fReadSPIdataXbits( spi_device_handle_t &h, int _readaddress, int *rxbuf, int rxlen );
int fWriteSPIdata8bits2( spi_device_handle_t &h, int _sendData );
Chevelle:
I am finding that the ESP32 can stop working with WiFi if there are any brownout conditions. Make sure that you have plenty of current in your power to the ESP32.
its no disconnection problem the esp stays connected it just stop sending data if i disconnect the socket client and connect it again it starts sending some frames and stops again but the connection to the wifi router is still there
Idahowalker:
Before WiFI.connect(), issue a WiFi.disconnect()
You'll get 2 things. One thing is if connected, disconnect. Eh. The other thing is that a WiDi.disconnect() resets the WiFi stack to default.
The next thing, with the ESP32 are you using the ESP32 SPI API?
no im not using direct the esp spi api im using a own spi class which is using the arduino api(check the attached files) and i cant see any problems with the spi this is working well.
ok sorry @Idahowalker u r right its losing the wifi connection for a very short time but dont now why and how i can prevent it and if i reconnect the client(pc side) its losing than very fast the connection again someone got an idea whats happening there
tryed ur hint with the disconnect before conneect didnt helped still short connection lost
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 5 - STA_DISCONNECTED
11:20:25.629 -> [W][WiFiGeneric.cpp:353] _eventCallback(): Reason: 200 - BEACON_TIMEOUT
11:20:25.629 -> [E][WiFiClient.cpp:392] write(): fail on fd 56, errno: 113, "Software caused connection abort"
i getting this error and debug msg maybe someone can help me to prevent it