I2C, save(), onInit(), Internal Error - issues #243
Replies: 4 comments
-
Posted at 2014-03-26 by @gfwilliams Thanks - someone else mentioned about the lack of info on Which command for I2C did you have to run in |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-26 by thomc Unfortunately that doesn't seem to work for me. On Espruino 1.58, the following code example works:
If I unwrap the It does seem to set it up though:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-26 by thomc In fact further testing showed that in my example which works, if I press the reset button it continues to work. But as soon as I cut the power and reapply, it fails. If I execute So the only way I've got it to work 100% is to run it all in onInit() |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-27 by @gfwilliams Right - well it's expected that you'd have to run SAMConfig in However you shouldn't need |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-03-26 by thomc
Hi, I'm really enjoying playing with the Espruino but recently had a small issue, mainly due to still learning to adapt from classical µC programming style. I figure this may help someone else who Googles for the keywords I did.
I got the NFC module running well, and then wanted it to persist after reboot so typed
save()
. When it rebooted the I2C interface couldn't be brought up (INTERNAL ERROR: Timeout on I2C...
). It seems Espruino tries to restore the state when you saved it rather than re-run the program again, which was weird to me but I get it now.So I figured I'd use
delay()
to give the NFC I2C module enough time to init, but of course there isn't adelay()
function because this isn't how Espruino is supposed to work :)Anyway, I found putting some code in an
onInit()
function with the I2C init code in there, it will get run every time it powers on. This may seem obvious butonInit()
is not yet documented in the Espruino reference as far as I can see.Beta Was this translation helpful? Give feedback.
All reactions