Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for rtfm 0.3 ? #5

Open
dcarosone opened this issue Mar 29, 2018 · 6 comments
Open

update for rtfm 0.3 ? #5

dcarosone opened this issue Mar 29, 2018 · 6 comments

Comments

@dcarosone
Copy link

Disclaimer preamble: this is waaay low priority compared to all the other things going on, but this is a useful blinky project to demo RTFM.

I tried updating Cargo.toml to use RTFM 0.3, as a way of seeing what changed, and whether I understood enough to do whatever adaptation was required.

image

I didn't even know macros could panic 🙄

@dcarosone
Copy link
Author

Pursued this a little further this evening; got past the declaration of peripherals as resources and some of the other general updates. Currently stuck looking for the right -hal implementation for the Serial (etc) traits for stm32f103xx

@dcarosone
Copy link
Author

I should have known to look at your repos rather than crates.io.. found https://github.com/japaric/stm32f103xx-hal

@dcarosone
Copy link
Author

That was helpful and broke my initial logjam. Bashing away at the pile of compiler errors; now down to about 25 which is good progress. Next thing to tackle is the new DMA model and adjust the buffer accordingly.

One question (for now) relating to setting up the timers. hal::timer seems to have tim2+ but not tim1:

// where is Timer::tim1 for TIM1?
let timer1 = Timer::tim1(p.device.TIM1, LATCH_DELAY, clocks, &mut rcc.apb1);
let timer3 = Timer::tim3(p.device.TIM3, LOG_FREQUENCY, clocks, &mut rcc.apb1);

WIP at https://github.com/dcarosone/ws2812b

@dcarosone
Copy link
Author

dcarosone commented Apr 12, 2018

Ok, I'm at the point where all remaining errors are repetitious, and fall into one of two categories:

  • new dma and buffer strategy; luckily there's a nice blog post about this but it's a redesign that needs more time and thought than mechanical work I can give it this evening.
  • setting up timers (including the above) and passing them around, which might not be necessary any longer if the dma strategy is better.

I'm thinking that the start-stop timer stuff that's there now, and the comments about getting the cpu to do something while dma is banging bits out to the LEDs, get replaced by a couple of ringbuffers: one for serial data, one for dma data, and a task (or idle loop activity) that does the translation from one to the other.

That needs more thought and attention than I have just at the moment, but comments and hints are welcome. I'm also interested to learn what would be the more minimal/direct translation of the current design, with single buffers and passing the timers around to start/stop them.

@dcarosone
Copy link
Author

Regardless I've learned a lot already, so yay!

@dcarosone
Copy link
Author

dcarosone commented Apr 20, 2018

Progress! Down to 9 errors (which includes several repetitions :)

Worked around the either issue by just defining a local copy of the enum

Current blockers:

  • tim1 / TIM1 seems to be missing from the timer hal impl (see linked issue above)
  • set_duties() seems to be missing from the pwm hal impl
  • how to pass timer state around as resources so that handlers can start/stop them (haven't really looked much at this)
  • dma handling for the non-serial case of the WS2812_BUFFER (will be similar to the serial case, but haven't pursued until there's a set_duties() to pass it to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant