esp32 rebooting due to weird cause

oferrer
Posts: 3
Joined: Mon May 08, 2023 1:14 am

esp32 rebooting due to weird cause

Postby oferrer » Thu Dec 26, 2024 1:58 pm

Hello,

I have the rebooting esp32 problem. I can't find out the cause but I can avoid it and reproduce it again.
I have these functions to access a device using SPI and everything is well, but when I wrap these functions in
an object class the rebooting problem arises. Any experience or suggestion?

Functions

Code: Select all

void dev_init(uint8_t sck, uint8_t miso, unit8_t mosi, uint8_t ss);     // called from setup function
bool dev_read(uint32_t &value);                                                      // called from loop function 

SPIClass spi(VSPI); // instance for data transmission


Wrapping class

Code: Select all

class Device
{
public:
    Device(uint8_t bus);
    void init(uint8_t sck, uint8_t miso, unit8_t mosi, uint8_t ss); 
    bool read(uint32 &value);
    .
    .
    .
privare:
   SPIClass spi;
   .
   .
   .
};

Device::Device(uint8_t bus) : spi(bus) {...}

void Device::init(uint8_t sck, uint8_t miso, unit8_t mosi, uint8_t ss)
{
   // idem implementation
} 
bool Device::read(uint32 &value)
{
   // idem implementation
}

Device dev1(VSPI);;
//Device dev2(HSPI);

dev1.init(...) // called from setup
dev1.read(...); // called from loop


Who is online

Users browsing this forum: Semrush [Bot] and 3 guests