Giter Club home page Giter Club logo

Comments (7)

japaric avatar japaric commented on May 20, 2024

Have you checked the API documentation of the device crate? cortex_m::peripheral::SYST is re-exported there. That struct not only gives you access to the SysTick registers, but also a high level API to generate periodic interrupts.

I can expand the example.

from cortex-m-quickstart.

therealprof avatar therealprof commented on May 20, 2024

I have, though it was not trivial to find it there. The whole setup is still a bit confusing with some registers being generated on the fly from the SVD files and others not and many of them having all-so-slightly different names than the original ones.

I'm still fighting with setting up the SysTick timer, though. I cannot get it to fire using Rust code while other (C-based) APIs work just fine. The exception vector seems to be set-up alright and the SysTick initialisation is fine as well; most likely I'm missing some magic NVIC initialisation here or there's some conflict in the interrupt handling since all other sources do not use a critical section inside their SysTick handler...

from cortex-m-quickstart.

japaric avatar japaric commented on May 20, 2024

@therealprof See #16

from cortex-m-quickstart.

therealprof avatar therealprof commented on May 20, 2024

That's where I started from. I have the exact same SysTick and exception setup but the exception is never raised. I'm on a Cortex-M0 BTW, maybe that makes a difference wrt to the interrupt/exception default setup. Working code is fiddling with the Exception priority in the SCB which is what I'm checking out right now.

from cortex-m-quickstart.

japaric avatar japaric commented on May 20, 2024

I can think of two possibilities: (a) your device has a vendor specific SysTick timer -- SVD files have a field, vendorSystickConfig, to indicate this scenario; or (b) your device has no SysTick peripheral; this is something I have not heard about before. Maybe check if the writes to the registers are being performed by reading back the registers

from cortex-m-quickstart.

therealprof avatar therealprof commented on May 20, 2024

Hm, I got it working, but not reliably. Seems to be some random crap in the register somewhere.

Some nits about the SYST implementation: fn clear () does not make a whole lot of sense as clearing actually disables the SysTick timer because the exception is triggered when the count changes from 1 -> 0 which is also what causes the reload. Similarly the manuals suggest you should load the counter with the value 1 (for which there's currently no safe API) to ensure that the timer will not start with some offset in the first turn and also the correct value for the reload is actually - 1.

from cortex-m-quickstart.

japaric avatar japaric commented on May 20, 2024

Closing since #16 landed.

@therealprof I have forwarded your feedback on the SYST API in rust-embedded/cortex-m#59

from cortex-m-quickstart.

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.