Help with using the i2cdev library with NodeMCU V2(ESP8266)


So I was working on a project which updates an aeroplane graphic on Processing according to values received through the serial monitor from the NodeMCU which is uploaded with a sketch based on the i2cdev library created by Jeff Rowberg. The code works as intended on an Arduino UNO board however I have had no luck getting it to work with the NodeMCU. I have tried to find a cause for this but have been unable to do so.

Looking at a couple of videos online, I saw that the project works with an ESP32 as well. Heres a link demonstrating it in action on an ESP32.

Heres the link to my github repository containing all the code for the project:

Also, this is the output from the serial monitor when I upload the code:

Initializing DMP...
>*......>......-2454.00000,     -1485.00000,    1122.00000,     48.00000,       -33.00000,      -86.00000

Enabling DMP...
Enabling interrupt detection (Arduino external interrupt 14)...
ISR not in IRAM!

User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Abort called


ctx: cont
sp: 3fffff70 end: 3fffffd0 offset: 0010
3fffff80:  402027f4 3ffe8f98 0000000e 402044de  
3fffff90:  3ffeed4a 00000004 3ffeeecc 40202a6c  
3fffffa0:  3ffeed4a 3ffeed50 3ffeeecc 40201352  
3fffffb0:  3fffdad0 00000000 3ffeef20 40203244  
3fffffc0:  feefeffe feefeffe 3fffdab0 40101159  

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
��␂�␒�o��r��N|�␄l␄�␜�$`␂␜c���␀␄��␒{��l�n�␄�o�␀␌$`␃��{�l�$2�␌␄␄�Initializing I2C devices...
Testing device connections...
MPU6050 connection successful

Send any character to begin DMP programming and demo: 

Sending a character on the serial monitor again gives the same result again. The error message suggests somes issues with the ISR and IRAM handling in the project.

The connections to the board and a summary of the project have been provided in the file in the github repository.

Any help would be appreciated in helping me set up this project for the NodeMCU!

Note: Currently the code is set to display ypr(yaw pitch roll) values on the serial monitor on hitting ENTER. Inorder to see the visual demo in action you will have to comment out

and uncomment #define OUTPUT_TEAPOT

It is a requirement for interrupt service routines to be in instruction RAM on the ESP8266, instead of in flash. This is documented here.

So in your application code,


is wrong because you didn’t mark the function with IRAM_ATTR. It should be

void IRAM_ATTR dmpDataReady() {
    mpuInterrupt = true;


Thank you, works like a charm!