Chat freely about anything...

User avatar
By Tired2
#32748 Hi,

I found the ESP8266 and thought it perfect for a sort of 'web enabled motor controller' project I have been wanting to do.

After playing with NodeMCU and finally getting Sming going, I found that there are some problems with the hardware PWM system that I don't think I can circumvent. (90% duty max, random flicker, etc).

So, I decided the best thing to do would be to pop a true real time capable system next to the ESP and assign the tasks based on where they are appropriate. (Web server on ESP, PWM on Arduino, etc).

My question:

What is the best way to do inter-MCU communication? I want the ESP to run a web server with sming, take input from a browser, etc, so the AT command set is not what I'm looking for.

I obviously could use serial UART, but then programming/debugging the chip will be a problem. I've read that there is a second hardware UART, however I don't see any code (in Sming for instance) on how to bind to the second UART.

Is SPI appropriate? It seems like the other obvious choice. Can SPI on the ESP do real time, or will the networking workload cause delays?

I'm trying to avoid things that rely on software timing on the ESP, since the TCP/IP stack and wifi, etc, take up so much time and they will make my motor operation jittery.

A few extra details, my required bandwidth should be pretty low, probably a 10 byte telegram every 100ms or so bidirectionally.

Thanks!
User avatar
By danbicks
#32752
tomte76 wrote:I use I2C/TWI to communicate with my Atmega MCUs. The ESP is bus-master and read/write data from/to the Atmega. As the ESP I2C sometimes shreds data I secured the transmission using CRC checksums. Works fine so far.


Hi,

This sounds cool, would like to see the arduino 328p slave I2c code and esp master code if you get a chance.

Regards

Dans
User avatar
By Tired2
#32756
tomte76 wrote:I use I2C/TWI to communicate with my Atmega MCUs. The ESP is bus-master and read/write data from/to the Atmega. As the ESP I2C sometimes shreds data I secured the transmission using CRC checksums. Works fine so far.


I had planned to checksum it, however I'm surprised it fails regularly. Thanks for the response, I think I2C is probably my best bet. I forgot all about it.

I'd love to check out your code if you are willing to make it available.

Thanks.