issue with I2C on pico (initialization) #972
Replies: 13 comments
-
Posted at 2018-03-29 by @gfwilliams Just checking - but you also changed That is a strange one. .. and you're calling Could you add a |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-03-29 by MikeD Yes, i changed it to I2C2 and no, the timeout was just inline. I will try it inside the init. As it is, I'm still a bit unsure of execution. It seems when I send the code to the device, it gets executed immediately. that does not, however, happen when plugging it in? I thought the code gets parse every time it's powered on. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-03-29 by @gfwilliams
Yes, that could be your problem. Check out http://www.espruino.com/Saving - it should hopefully clear up what happens. By default code is executed as it is uploaded, and You can change how it works, but then you miss out on the ability to tweak things on the fly using the left-hand side of the IDE. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-03-30 by MikeD tried putting timeout in E.on('init') - nothing. it almost seems as if the init function does not get called when the device is plugged into power. in fact, try running this and let me know if it works:
for me, it only works when i run load() from command line.. on powerup, nothing happens |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-02 by MikeD anyone? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-02 by Frida Try with an extra timeout
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-02 by MikeD that worked! now can someone explain why? I also noticed that taking the 1500 delay down to 1000 fails as well - does the board inherently have some issue with 'settling' for 1.5 seconds? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-03 by @allObjects I do not exactly know, but there something run after your
If it is not working, the console meddling could could have something to do with it... Important (for my use is), that I never |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-03 by MikeD i suppose i2c initialization could take longer? any way to make it asynchronous? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-03 by Frida @allObjects, I allways use onInit(), but yes it needs the time too. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-04 by @gfwilliams
What if you remove the |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-04 by MikeD I tried taking out setConsole.. still seems to need a delay. would probably be a good idea to have some sort of an event for 'ready' rather than 'init' if it's an issue of internal processing time to get things going.. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-04-05 by @gfwilliams So it does work with the There's this issue on boards with USB where often people want stuff running as soon as possible, but then that's before USB has initialised properly. It used to be that I'd wait until USB had initialised but then people complained - but good call on the event. It would be a nice way around it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-03-29 by MikeD
Hello,
i'm writing a simple timer using an Adafruit 7 segment display which uses I2C.
I have made a working prototype using the original kickstarted Espruino and wanted to transfer the design to the pico.
The display requires initialization which I do in an E.on('init') as well as inline:
For the pico, i changed the pins to B10 and B3
The problem is that while i'm on USB, the init works just fine. However, when I save the code and run it with a battery, the LED init fails. I later tried to call the init on BTN1 and that works fine. Something about initial power that's not working. I tried setTimeout to call it and that fails as well.
I also tried the USB.console trick and that didn't help.
Any ideas?
I'm running latest firmware available
Beta Was this translation helpful? Give feedback.
All reactions