GithubHelp home page GithubHelp logo

Comments (19)

JF002 avatar JF002 commented on May 18, 2024 1

Thanks for your work, it looks promising.
If the watch reset every 10s, it might come from the watchdog, which is configured to reset the cpu if has not been refreshed for more than ~7s.
The wdt is refreshed by the SystemTask. You should check if there is nothing that blocks or slows down the loop in SystemTask.

from infinitime.

JF002 avatar JF002 commented on May 18, 2024 1

Accelerometer and heart rate sensor have been integrated in version 1.0 :)

from infinitime.

JF002 avatar JF002 commented on May 18, 2024

You couldn't find the accelerometer and heart rate sensor code because... there it doesn't exist (yet)...

I did some work related to these sensor, and even managed to make a small demo of both of them working in InfiniTime.
I haven't pushed these changes because of license issues : I want InfiniTime to be really open source (that's why I chose the GPLv3 license) and the code I wrote for these sensors was based on non free/proprietary code, blobs and libraries :

  • The heart rate sensor needs a library to drive the sensor and compute heart rate values from raw values
  • The motion sensor needs a binary BLOB (configuration file) to be uploaded to the chip for advanced functionalities (step counting, for example).

There's very few documentation, datasheet and example code about these 2 devices, and the implementation will certainly need a bit of reverse engineering. I know that ATCWatch and Wasp-OS worked on the support of these chips, but I don't know which license is applied on their code. It might be worth to have a look.

If you (or anyone else) want to write a driver for these devices, I will happily share the rest of the code (UI, message passing between tasks,...).

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

Ah, that accounts for it then.
I will look at the accelerometer first and aim to make something that will use interrupt driven monitoring of the accelerometer without using anyone else's code. I did this for a different accelerometer chip a while ago so as long as the chip datasheet has the information on which registers you need to set etc. it should be possible - I seem to remember reading the datasheet for it a while ago before I got distracted by another aspect of my project.

If you could share what you have done, that would save me a lot of effort understanding the software 'infrastructure' - I have only ever used FreeRTOS as a C implementation using old fashioned makefiles so find this one a bit daunting to start on!

I'll go and read a datasheet......

Thanks!
Graham ([email protected])

from infinitime.

JF002 avatar JF002 commented on May 18, 2024

I remember I pushed the branch hrs3300 a while ago for consultation only (I won't merge it as is).
The low level drivers are in https://github.com/JF002/Pinetime/tree/hrs3300/src/drivers.
Then there are 2 'controllers' (motion and heart rate) in https://github.com/JF002/Pinetime/tree/hrs3300/src/Components/Motion and https://github.com/JF002/Pinetime/tree/hrs3300/src/Components/HeartRate. These controllers provides easy API to the UI, so that the UI does not depend on the drivers directly.
There is also the heart rate task (https://github.com/JF002/Pinetime/tree/hrs3300/src/HeartRateTask) that runs when heart rate measurement is required by the application.

Do not hesitate to ask any questions, I would be happy to answer them !

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

Thanks!
I hope I will be able to use those commits to see how you added a component etc, then I can start writing things to the screen and will feel like I am getting somewhere - first task is to read the ID from the chip, which will prove we can talk to it.....
I will let you know how I get on.
Graham.

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

I am trying to merge your 'main' branch into my fork of the hrs3300 branch to get the code bases consistent before I start.
I think the cMake parts are working, but I am getting a compile error I don't understand (I don't use c++ much!) - it is complaining about the "new Screens::ScreenList" here https://github.com/OpenSeizureDetector/Pinetime/blob/hrs3300/src/DisplayApp/DisplayApp.cpp#L205

Error is:
DisplayApp.cpp:205:26: error: expected type-specifier
205 | currentScreen.reset(new Screens::ScreenList(this,

It is getting a bit late now so I will look tomorrow, but if this error is obvious to you, I would appreciate your thoughts on what is causing it!
Thanks

from infinitime.

JF002 avatar JF002 commented on May 18, 2024

Mhm this branch generates a lot of warnings, but no error on my side...

Which version of the toolchain do you use ? I'm using this one : https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads/9-2020-q2-update.

Could you also try to delete the build directory and start again from scratch (cmake & make)?

And if it does not work, could you provide the whole error message?

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

I didn't find the problem, even after updating the toolchain. I think it must be something to do with how the header files were updated - but I don't understand how it compiled for you.
I decided that I will learn more about how your code works if I implement the 'Motion' app myself using your code as examples, so am working through that. I think I have got that bit working now, so will actually try and talk to the accelerometer chip tomorrow....

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

I have made some progress - mostly with learning the structure of the code so I can add a screen to display data, and am just starting to look at TWI_master to start to talk to the accelerometer chip.
I looked at the code from Bosch (BMA4.c etc.), and I wondered what the issue is with using it? It looks like it is nicely written code, and has a permissive licence - do you think it is incompatible with a GPL3 project? It says it can be distributed with or without modification provided we keep their attribution, which sounds ok to me.
I have never looked much at compatibility of different open source licences though so I may have missed something? It is just that what I write will be very similar to the Bosch version, but not likely to have all of the features and error checking that their code has in it....

I also wondered about TWI_master - I can't see a way of checking if a read/write is successful or not. Have I missed something, or should I expose the structure that reports error codes etc., either by making it public, or adding getter functions - do you have a preference?

Thanks
Graham.

from infinitime.

JF002 avatar JF002 commented on May 18, 2024

Sorry for the delayed answer !

I'm not sure there are any license issue. These files come from unknown sources and I don't know if we can use it in a FOSS software. If I recall correctly, an SDK for the BMA423 is available on Github, but not for the BMA421. It also needs a BLOB (configuration file) to enable advanced features like step counting, and we don't have the sources of this blob.

Maybe we just need to take the time to check that it is OK (and compatible with GPLv3) to use them in the project?

Regarding the error management in TwiMaster (and other drivers), you're right, there's not much. The first reason is that I haven't taken the time to think about it. Second reason is that if a transfert fails, there's not much we can do at the application level in case of error, except maybe retry (or reset). So, any help on this subject is welcome :)

What structure would you want to expose?
In "normal" project, I would use exception, but I don't think that's a good idea for embedded, so error codes (enum class ?) returned by method might be a good candidate.

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

from infinitime.

Avamander avatar Avamander commented on May 18, 2024

Do you know if it is possible to get a 'serial' console on the device over BLE or SWD?

Yes, either ARM Semihosting or Segger's RTT are both possible.

from infinitime.

Avamander avatar Avamander commented on May 18, 2024

@jones139 This is the accelerometer blob that we don't know the license of: https://github.com/daniel-thompson/bma42x-upy/raw/master/BMA421-Sensor-API/bma421_config.h

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

Ah, thanks - I will read up on what that does - it looked like you should be able to get the main accelerometer functions by just reading and writing registers (based on the BMA423 datasheet), but I will see.
Just having trouble with my SWD interface which seems to have stopped working reliably - hopefully I have got a loose connection in the pinetime - otherwise I've wrecked the pinetime and will have to start on one of my P8's instead.... Will get back to the accelerometer once I can talk to a watch!

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

I have just tried incorporating the open source BMA423 library from Bosch (https://github.com/BoschSensortec/BMA423-Sensor-API) and using that with minimal modification (just changed the expected chip_id.
It looks promising - I can read at least one value of acceleration and temperature from the chip. The config_file write fails with an invalid file error, so I don't think the on-chip step counting etc. will work - but we could implement that on the watch cpu if we have to.
There is still something wrong in my code (https://github.com/OpenSeizureDetector/Pinetime) because the watch resets every 10 seconds or so, and the accelerometer values are not updating on the screen. I will have to cure that first, then try and get the FIFO and interrupt working, which is likely to be important to keep the watch power consumption down.

from infinitime.

donpdonp avatar donpdonp commented on May 18, 2024

I'd really like to see a heartrate sensor on infinitime. I searched around the wasp-os code for the relevant bits and the license is LGPL-3.

the hardware driver
https://github.com/daniel-thompson/wasp-os/blob/master/wasp/drivers/hrs3300.py

the "Photoplethysmogram (PPG) Signal Processing"
https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py

from infinitime.

jones139 avatar jones139 commented on May 18, 2024

from infinitime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.