Comments (8)
Please provide Sketch output and the expected output. Thanks.
from arduinocore-arc32.
For example, millis() sometimes returns value which is less then previous calls, and then returns to normal on the next call.
This looks like interrupt locking problem, and is reproducible not only with millis()
.
This happens regularly when IMU or BLE is used frequently.
from arduinocore-arc32.
@vshymanskyy the millis function reads a counter that requires a regular interrupt to be updated.
In the sample code shown at the link above, CurieIMU.readMotionSensor is being called from interrupt context; This function, like most CurieIMU functions, involves communicating with the BMI160 via SPI, so it takes up a lot of time. So much time that you apparently miss a bunch of timer interrupts, while hanging around in interrupt context waiting for data from the IMU. I strongly recommend not to call CurieIMU functions from interrupt context. Same goes for BLE.
Really, anything that involves slow hardware comms, or communication with an external device, you should never run it in interrupt context.
from arduinocore-arc32.
@vshymanskyy can you show us some code please? without it, I will assume that you are doing the same thing that hsuenaga is doing on the forum link you provided (calling long-running / blocking IMU/BLE methods in interrupt context).
If this is the case, then a common solution is to modify your callback function so that all it does is set a global flag. Then in each iteration of loop()
, you check if the flag has been set, and if so, you call your blocking BLE function, or whatever it is you need to do. In this way, you get out of interrupt context as quickly as possible and do the slow stuff during normal execution.
from arduinocore-arc32.
@eriknyquist , yes I think I have a bit different case.
I'll try to make a minimal sketch showing the problem -> but it will take some time. I think a week or so. Thanks!
from arduinocore-arc32.
@vshymanskyy I'll be here!
from arduinocore-arc32.
@vshymanskyy any updates on this?
from arduinocore-arc32.
@vshymanskyy closing the issue due to a lack of response. Feel free to re-open if you ever return to it.
from arduinocore-arc32.
Related Issues (20)
- Error compiling for board Arduino/Genuino 101. HOT 7
- Peripheral not connectable when broadcasting characteristic value
- Incorrect capitalization of true in CurieIMU documentation HOT 3
- some EEPROM.CPP ERROR HOT 1
- SPI.beginTransaction allows SPISettings faster than 8 MHz
- Cannot discover attributes HOT 1
- Limited error messages, when selecting the wrong COM port
- How to using UART ISR ?
- [Urgent][Stuck Problem] BLE setValue in callback function!
- Can't send BLE data less than 25ms? HOT 3
- Crashing when three or more characteristics are updated every 30ms? HOT 1
- CurieBLE - BLECommon dosen't existe .. HOT 2
- CurieBLE for HM-11
- Should extra_flags be empty in platform.txt? HOT 1
- SoftwareSerial core library
- IPAddress missing definition of operator!=()
- When I try to upload a simple sketch to the Arduino 101, I get the following error on Mac M1 (macOS Monterey) HOT 3
- No tag for 2.0.6 release
- error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor." #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor." HOT 2
- Placing the breadboard with BMI160 to horizontally(remapping axis) HOT 1
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 arduinocore-arc32.