does MPU6050_DMP module work on Puck? #3164
Replies: 14 comments
-
|
Posted at 2019-11-04 by @allObjects Are you already have "Save on send" checked in the Espruino Web IDE Communication Settings? In addition, add the onInit() method and put the connect in there. This helped me - in my case - over some memory issues. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-04 by @MaBecker MPU6050_DMP is a large module even min version is about 11KB. Not sure if this will work on a Puck. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-04 by @gfwilliams It's possible it is a bit tight, but to give it a fighting chance try:
That way you end up with the code executed from flash memory, which should help with RAM usage. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-04 by barrier Thanks @gfwilliams, with those settings MPU6050_DMP now works on my Puck |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by barrier Unfortunately, I must have caused a problem with my flash, and I need help returning to a stable state. After a hard 10 second reset, I can connect my puck in the IDE, then with the same connection settings as above, I send the following code to my Puck: This code worked yesterday, but now I'm seeing an error:
Then I get a red bar and nothing else.. any advice? |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by @allObjects Mostlikely, your modules has some initialization that has to happen... and you try not to save active things (intervals, timeouts, watches, etc, even though @gfwilliams did a great job to restore them as good as possible). I'm also a bit puzzled about your use of const and var for the very same thing... Place 'all active stuff' into a onInit() function - ESPECIALLY with Save on send setting and to avoid (heavy) things getting off on upload (starting heavy things on upload and writing to console in upload - level 0 / directly executed code messes even with the upload to not complete it or preventing Espruino to detect completion of upload. --- I expect this to solve the issues): You may also be fine with: |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by @MaBecker Don’t miss to call onInit() or save() 😉 |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by @allObjects I don't know the data coming from DMPU... could you post a console output? |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by barrier I'm struggling to get my Puck back to a stable state. If I just send the following: The ide shows " Prompt not detected - upload failed. Trying to recover..." and then never seems to recover. I think I need a way to clear out or factory reset the flash memory. I've tried running reset() followed by save(), but that doesn't fix it. Also the web ide won't connect to my Puck unless I do a hard reset first. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by @MaBecker Try reset(true) |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by @allObjects The upload process is time sensitive: the IDE sends stuff to the Espruino board, Espruino board interprets it and responds back for the next junk. Espruino is a totally different architecture than you may be used to from other microcontroller setups, such as Arduino, to name an example. Even though some time has passed since the conversation about simple explanation how to save code that Espruino run on start? and Espruino got much more powerful, robust and resilient, the architecture has not changed. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-05 by @allObjects I'd like to be a bit more specific about the general type of upload vs. the various kinds of uploads in Espruino context. The general type of upload is to move bytes from a source environment storage to a destination environment storage. On both source and destination sides, a simple read and write tooling is in place that just reads the bytes and puts them on the line or gets them from the line and just writes them - without any serious transformation - like a file transfer. If the 'file transfer' has some smartness, it knows about the data type and may do some formal conversion, such as a character set conversion, endian conversion, etc. Any conversion though is the begin of heating the water and because it is gradually, it will boil the frog - what ever that 'boiling the frog' means and manifests itself in... for example with: New Interpreter Interruption / Stack Overflow / Out Of Memory / Fifo Full / ... because of: see next paragraph. In Espruino, neither side's tooling - source-reading-sending nor destination-receiving-storing - is simple. On source side it is parsing code in nested, recursive manner to find all - not Espruino firmware built-in, involved modules and upload them to and store them either as source code or function in the Modules cache or flash EEPROM before uploading the actual root / level 0 code / IDE editor pane code - the code that is stored in the projects folder. The parsing is recursive because not only the 'project' / level-0 / project code can contain On destination side the code goes thru the interpreter which does some parsing and processing as well - depending wether it is project and module code, and when latter wether to store it as straight source code or as function. If that processing gets too heavy, the upload process may fail. While all code code arriving on the Espruino interpreter side, some is 'just' definition code, like a When having heavy active code in the upload and lots of code to upload, timers that are early on created by setTimeout() or setInterval() - and console.log() - may already be firing even before all code upload has completed. Too early firing may collide with upload communication content and timing, like application output to console interferes with upload because for both the same console connection and REPL is used, and timing wise, cpu resource is divided between performing upload task and and executing application code. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-07 by @gfwilliams Can you try running |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-11-09 by barrier Thanks @gfwilliams that fixed it. It may have also been a loose connection on the mpu... Also thanks @allObjects I see that by loading the modules in onInit(), and other practices, my code is running much more reliably. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-11-04 by barrier
I'm able to use the MPU6050 module correctly on my Puck
I2C1.setup({scl:D2, sda:D1, bitrate:100000});
const MPU = require("MPU6050").connect(I2C1);
But if I then add the MPU6050_DMP,
var DMP = require("MPU6050_DMP").create(MPU,3);
Does anyone know if the MPU6050_DMP works on Puck? Am I just running out of memory? Is there a workaround to get this module loaded onto Puck? Thanks
Beta Was this translation helpful? Give feedback.
All reactions