M5Stack, EspSoftwareSerial interrupt.h File Not Found

I need 3 serial ports on an M5Stack project. Yes, I'm aware that there are 3 hardware ports on an ESP32, but only 2 are exposed, and Port 0 is reserved for the USB Comms. So I need 2 more.

I've installed EspSoftwareSerial on my IDE 2.3.4 and if I try to compile the EspSoftwareSerial examples (like loopback.ino) I get the error "avr/interrupt.h File Not Found" :

\Arduino\libraries\SoftwareSerial-master\SoftwareSerial.cpp -o nul
Alternatives for avr/interrupt.h: []
ResolveLibrary(avr/interrupt.h)
  -> candidates: []
exit status 1

Compilation error: exit status 1

I have been googling this error for days and I can't find a solution.
Any ideas?

Sir Michael

if you are using a ESP32 I doubt if it will find avr/interrupt.h which is for handling interrupts on Atmel AVR microcontrollers

what do you wish to do on the ESP32?

EDIT: File>Examples>EspSoftwareSerial>loopback compiles OK on IDE V2.3.4
using Tools>Board ESP32 Dev Module

How did you do that?

This looks like you manually downloaded and installed the ZIP. The EspSoftwareSerial library is available through library manager. I did install it that way and did not experience issues, even after installing the M5Stack board package.

Horace,
Are you suggesting that I try to compile the using an ESP32 Dev Module, rather than the M5Stack library?

To answer your question, I'm controlling an amplifier. This was previously built on an Arduino MEGA with a remote display, but I've redesigned using an Arduino NANO at the amplifier which interfaces through COMMs between the NANO and the M5Stack (separated by about 15'. The M5Stack handles the user I/F, antenna switching (4 Relay board) and Comms with the Radio to read the frequency to change Amplifier band & antenna. The 3rd port is to be used to emulate a commercial amplifier so I can operate remotely.

Sterretje,
Yes, I, I may have installed the EspSoftwareSerial manually from the .zip file.
I tried to uninstall it, and re-install it using the Library Manager. I still get the error.
Would it help to completely uninstall the Arduino IDE and re-install the M5Stack & EspSoftwareSerial?

Sir Michael

It might be a cache problem, not sure. You can delete the content of C:\Users\yourUsername\AppData\Local\arduino.

I tried that (deleted: \Users\yourUsername\AppData\Local\arduino) , didn't work either...

I also changed from boards from M5Stack to ESP32 Dev Module and that fails as well.

Sir Michael

One library with a file named SoftwareSerial.cpp that attempts to include a file named avr/interrupt.h is part of the AVR core. Maybe you somehow attempted to use some derivative of it?

In any case, try (re)moving that entire subdirectory of your sketchbook, \libraries\SoftwareSerial-master, so that the only SoftwareSerial.h in \libraries is \libraries\EspSoftwareSerial\src\SoftwareSerial.h

Kenb4,

Yes, that was it! Bottom line is that there was another SoftwareSerial that was found and was incorrect for the EspSoftwareSerial.

I actually went to the C:\Users\xxxx\Documents\Arduino\libraries and did a search for "SoftwareSerial" and came up with about 6 or 7 directory instances. I started by renaming them with -1, -2, etc, but that didn't work. (I wasn't sure I wanted to delete all of them!) That didn't work, so I noticed that the compile error had a full path. I tried renaming the directory with a -7, but the compiler still found it (with the -7 extension). So, I found the SoftwareSerial-master-7, deleted it and now it compiles correctly!!!

I'll still have to make sure that I have the SoftwareSerial for the AVR (I do use it in some of my
Arduino NANO projects).

Thanks Everyone so much for your help!

Sir Michael

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.