Page 1 of 1

Porting to ESP32

Posted: Fri Apr 09, 2021 8:25 am
by thornogson
Hi guys, I have been thinking about the ideal next gen,all-singing, all-dancing plug and play inverter brain (particularly for Toyota inverters) whilst fiddling about with a number of microprocessors, has anyone considered porting Johanes's software to the ESP32 chip ?
Because ....
it has 2 separately addressable cores,
runs at 160 or 240 MHz ,
has 448 KB ROM and 520 KB SRAM
Built in Analog to digital and digital to Analog converters
Onboard Bluetooth, UART and wifi,
masses of IO pins , and it's absurdly cheap

There seems to be plenty of hardware real estate for future developments in a tidy $10 package

Re: Porting to ESP32

Posted: Tue Apr 13, 2021 8:49 pm
by johu
Just skimmed over the data sheet, specifically the timer.
Also checked libopencm3, that doesn't support it. Well it's not a CM3 so no surprise. So either that is added or some other HAL is used.

The timer is capable, it has 6 outputs with deadtime generation. It has two ADCs so one could be used for the scan channels and the other one-shot triggered for resolver.

I think it also has CAN, just they call it TWAI :) probably to circumvent license fees.

Also the web interface could be integrated on chip.

So it's definitely possible and quite interesting :)

Re: Porting to ESP32

Posted: Sat Apr 17, 2021 12:30 am
by collin80
thornogson wrote: Fri Apr 09, 2021 8:25 am Because ....
it has 2 separately addressable cores,
runs at 160 or 240 MHz ,
has 448 KB ROM and 520 KB SRAM
Built in Analog to digital and digital to Analog converters
Onboard Bluetooth, UART and wifi,
masses of IO pins , and it's absurdly cheap
Two cores? Check! Though, you will have trouble with wifi if you start trying to use them both too heavily.
Lots of RAM and FLASH? Check!
Built in ADC and DAC? Yeah, pretty much all processors do
Onboard BT, UART, Wifi? Yep. You can even do BT and WiFi at the same time
Masses of... wait... Are we talking about the same chip here? It has a PITIFUL number of I/O pins. Most all of them get used up by the need for external FLASH and a few other things. My biggest complaint about the ESP32 is how pin limited it really is. I have never heard anyone say that they think the ESP32 has a lot of I/O pins.
Absurdly cheap? Yes, yes it is.

Re: Porting to ESP32

Posted: Sat Apr 17, 2021 12:06 pm
by davefiddes
I've used the ESP32 for a few projects. It's a great chip but has many limitations. In particular it's really difficult to get hard real-time deterministic interrupt handling. This is because of the SPI connected program flash and layers of cleverness to make it transparent. You have to carve out chunks of SRAM and copy your code there. The ADC and DAC are pretty basic and noisy. It's really aimed at IoT applications.

An ESP32 would make a good secure multi-CAN/serial interface though.

Re: Porting to ESP32

Posted: Sat Apr 17, 2021 1:33 pm
by johu
Ok, that does not sound too promising. In-deterministic latency in a real time application is asking for trouble. Noisy ADCs don't help either.