<re_irc>
<@richarddodd:matrix.org> @dirbaio:matrix.org: Teach a man to fish... :)
<re_irc>
<@zpartacoos:matrix.org> Hi, I'm going through the discovery embedded book and ran into a strange issue with the blinky example. All I did was try to increase the time to 5 seconds and now gdb just hangs. I wrote a comment on an existing [thread on github](https://github.com/rust-embedded/discovery/issues/295) to a similar issue. If...
<re_irc>
... you know how to fix this I'd really appreciate the help as I'm just getting started with embedded rust.
<re_irc>
<@adamgreig:matrix.org> are you able to interrupt (ctrl-c) while it's hanging and see what code it's in?
<re_irc>
<@adamgreig:matrix.org> it might be a bug/limitation of the delay function that it can't do very long delays, depending on how it's been implemented
<re_irc>
<@adamgreig:matrix.org> (for example, you could try `for _ in 0..10 { delay(500_u16) }` to get the same effect and see if that works)
<re_irc>
<@jamesmunns:matrix.org> @adamgreig:matrix.org: uuuuugh I thought we killed all of these bad copy/paste impls 😭
<re_irc>
<@sirhcel:matrix.org> zpartacoos: I could confirm your observation with the code i'm working on right now (for serial output). When using `delay_ms(5000u32)` my example hangs. According to the docs of the current git revision of the hal i'm working with, `delay_ms` is implemented using `delay_us` which should allow delays up to almost...
<re_irc>
... a minute.
<re_irc>
<@jamesmunns:matrix.org> sirhcel: could you link me to the hal please?
<re_irc>
<@jamesmunns:matrix.org> If it has the old+bad delay impl, I will open a PR fix right now.
<re_irc>
<@jamesmunns:matrix.org> I tried my best to find and squish them all a while back, but I bet I missed one.
<re_irc>
<@jamesmunns:matrix.org> (if there are any stm32f3 maintainers idling in here)
<re_irc>
<@jamesmunns:matrix.org> but, the code that was already in there (with or without my fix) is the biggest difference.
<re_irc>
<@sirhcel:matrix.org> Thank you jamesmunns
<re_irc>
<@sirhcel:matrix.org> Works like a treat now. :)
<re_irc>
<@sirhcel:matrix.org> zpartacoos: There are several changes in the `stm32f3xx-hal` ahead which actually prevent you from using jamesmunns 's fixed hal directly from github. sh3rm4n works on getting a new release of the hal out soon (tm).
<re_irc>
<@zpartacoos:matrix.org> Wow thank you all for the quick response. Just to confirm, sirhcel does that mean once the new hal is released this issue should be fixed?
<re_irc>
<@sirhcel:matrix.org> I'm working on getting the discovery examples updated for this new release. But we need the hal at first.
<re_irc>
<@sirhcel:matrix.org> @zpartacoos:matrix.org: You are welcome! :) I'm not a maintainer for the hal but I bet the fix will make it into the upcomming release.
<re_irc>
<@sirhcel:matrix.org> I hope you could live with the shorter delays meanwhile.
<re_irc>
<@zpartacoos:matrix.org> Yes it's no problem
<re_irc>
... anyone of you know, if there is a reason for that?
<re_irc>
<@sirhcel:matrix.org> In case it could be used independently of the actual cortex-m mcu: wouldn't this reduce the sources for potential issues with delays to one?
<re_irc>
<@adamgreig:matrix.org> yea, I think just cortex-m didn't have a delay impl at first, so hals had to do it themselves
<re_irc>
<@adamgreig:matrix.org> maybe in some cases the HAL has a better understanding of the actual clock frequencies though
<re_irc>
<@firefrommoonlight:matrix.org> Hmmm... I'll look into this more and switch to it if it looks apt
<re_irc>
<@firefrommoonlight:matrix.org> I did end up implementing a EH delay based on timers, but don't see much use
<re_irc>
<@adamgreig:matrix.org> yea, you have to pass ahb_frequency into cortex_m::delay to make the delay source, whereas the HAL can get that from whatever it uses to manage timing
<re_irc>
<@adamgreig:matrix.org> the HAL could probably just wrap cortex_m's delay though and handle the frequency
<re_irc>
<@firefrommoonlight:matrix.org> Yea - that's how you'd have to do it I think
<re_irc>
<@firefrommoonlight:matrix.org> Would be a small internal change, but prevents wheel reinvention
<re_irc>
<@lachlansneff:matrix.org> Are there any examples with using bluetooth with the nrf-rs crates?
<re_irc>
<@firefrommoonlight:matrix.org> I wonder if there a softdevice example somewheres
<re_irc>
<@firefrommoonlight:matrix.org> I'd like to add an example for stm32wb as well
<re_irc>
<@firefrommoonlight:matrix.org> The nrf manual has a decent section on its radio, but not much useful info for protocols impl. WB's radio section has little useful info
<re_irc>
<@firefrommoonlight:matrix.org> I think wb is designed to be used with special official BT software, but I haven't tried it
<re_irc>
<@thalesfragoso:matrix.org> Hmm, so I have some of those ssd1306 AliExpress modules, it has 2 0ohm resistors/jumpers on the back, does anyone happen to know which one is used to changed the address (if any) ?
<re_irc>
<@sirhcel:matrix.org> @adamgreig:matrix.org: Thank you, that explains a lot. :)
<re_irc>
<@sirhcel:matrix.org> @firefrommoonlight:matrix.org: The cortex-m implementation looks a bit different from the one @jamesmunns was writing his pr for. May be it needs some care too to support 32 bit values and wrapping around.
<re_irc>
<@firefrommoonlight:matrix.org> I haven't confirmed it handles wraps correctly
<re_irc>
<@firefrommoonlight:matrix.org> I think we can do 1-better: We really can skip it in HAL and direct users to use cortex_m::delay::Delay directly. However... it relies on EH traits, which I don't think is the way to go
<re_irc>
<@firefrommoonlight:matrix.org> You should be able to use the delay without importing EH
<re_irc>
<@firefrommoonlight:matrix.org> Otherwise, I'd delete my delay module intirely
<re_irc>
<@firefrommoonlight:matrix.org> adamgreig: Do you own that cortex_m? Thoughts on moving EH impl to bolt-on, as in the file I linked? If we do that, I'll delete that module entirely in HAL
<re_irc>
<@firefrommoonlight:matrix.org> Why you don't need a wrapper: