Comments (7)
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.
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.
@therealprof See #16
from cortex-m-quickstart.
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.
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.
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.
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)
- License files missing
- GDB Load Failed Due to Invalid memory.x Flash Layout
- Allocator example broken
- Document on a quickstart guide for Raspberry Pi Pico HOT 1
- Using probe-rs to initialise memory.x HOT 5
- Update VS Code Config to use unified stlink.cfg
- Make this repository a template HOT 4
- Debug have some problems "unknown command: `arm` " HOT 1
- "message": "failed to parse manifest at `/Users/tz/Downloads/cortex-m-quickstart-master/Cargo.toml`", HOT 2
- add a runner to flash program directly HOT 2
- Is it possible to run examples in `qemu`? HOT 1
- Error while following the Embedded Book HOT 2
- How to run the quickstart code on LPCXpresso55S69?
- cargo generate error HOT 3
- Blue Pill Quickstart HOT 5
- probe-rs HOT 1
- Update for stm32l4 dependency causes linker error HOT 3
- Add documentation ARM v8 Baseline and Mainline (Cortex-M23/M33/M35P)
- Documentation or example for the allocator not working HOT 3
- Feature request: Confusing task names HOT 6
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 cortex-m-quickstart.