Comments (9)
Ok, I can reproduce it! I just have to wait longer.
The fix from @TT-392 seems to work, even though I would have preferred to be able to actually fix the issue instead of using this kind of workaround.
For info, the 5000 loop iterations correspond to ~160550 CPU cycles, which corresponds to ~2.5ms @64mhz.
Now, I need to check that the code behaves correctly when the twi transaction is aborted.
from infinitime.
tt_392 on Matrix said:
I ended up just waiting for the thing to lock up, then turn off twim, force the pins back in the right position, and turn twim on again
from infinitime.
From our talk in the chat room, it looks like the TWI device is buggy and locks itself from time to time.
Adding a timeout in the driver and completely reset the TWI device when we detect a hard lock seems the only solution.
from infinitime.
Here is how I ended up fixing it btw
https://github.com/TT-392/TT-time/blob/master/src/external/infinitime/i2c_pine.c
As far as I understood from the nordic forums (allthough I can't seem to find the specific thread anymore). It seems that you specifically have to forcefully reset your SCL and SDA pins.
from infinitime.
@TT-392 Thanks for the fix! It looks like the TWI drivers hangs when SPI and TWI are heavily used at the same time... I guess you couldn't find another solution that would prevent the device from locking?
from infinitime.
Investigating this issue, I think it could be related to Nordic's hardware anomaly 109. Moreover, it could be also the same problem described on issue lupyuen/pinetime-rust-mynewt#24 affecting SPIM.
There are some workarounds in the mentioned document. Handling peripheral IRQ to wake up seems the best one in this case. See example code in 3.8.3 TWIM workaround subsection.
from infinitime.
I've just had a look at the anomaly referenced by @rafacouto. This is pretty bad : a race condition inside the CPU. And the workaround are quite complex to put in place.
However, the anomaly specifies that SPIM TX and TWIM TX are affected by the anomaly. TWIM RX is not referenced. But RX could be locked because TX caused the anomaly just before?
Anyway, I'm trying to reproduce it so that I can analyze that issue further... with no result for now
I've tried using InfiniPaint (paint app) from develop, and the pong game developed by @ColdBrewCaffine (https://github.com/ColdBrewCaffine/Pinetime/tree/Run-dev-2).
Soooo... can you help me find a way to reproduce this issue more or less reliably?
from infinitime.
I've implemented the fix recommended by @TT-392, it's running fine for more than 4 hours with the pong game developed by Electrolyte.
See this branch : https://github.com/JF002/Pinetime/tree/fix-twi-hang and this PR : #111
from infinitime.
Fixed in #111
from infinitime.
Related Issues (20)
- Turn off accelerometer in night mode HOT 3
- Can't connect to Gadgetbridge after Firmware 1.14 update. HOT 5
- Screen shifting upwards HOT 8
- Assert call being removed during compilation, causing NULL pointer dereference in ble_ll_task HOT 6
- Using GDB debugger in devcontainer does not load source map
- Stopwatch lap counter only goes up to 20 laps HOT 1
- Unable to update InfiniTime successfully
- Add unit testing framework and skeleton test project HOT 4
- looping recovery mode,.... infinite loop. ITime. HOT 2
- Not reconnecting to Gadgetbridge HOT 7
- What watch faces currently support weather? HOT 9
- Whats the best way to track what and when the next release HOT 2
- Add active alarm indicator to watch face HOT 4
- Fix Stopwatch Side Button Behavior HOT 1
- Use separate screens for switching off ringing alarm and for alarm configuration
- Firmware update with pinetime-mcuboot-app-dfu-1.14.0.zip and GadgetBridge fails HOT 2
- Wake-up Alarm does not sound in Sleep mode HOT 4
- Text disappears from watchface on chimes HOT 1
- BLE bond deleted after 2 reboots without connectivity to central HOT 3
- PineStore announcement : the current flash chip is EoL, a new one will be used for future PineTime batches
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infinitime.