<re_irc> <@t​halesfragoso:m​atrix.org> gdamjan: with enough hacks, maybe a logitech mouse wireless mouse dongle
<re_irc> <@t​halesfragoso:m​atrix.org> not sure if they use SB or ESB though, I think it was ESB
dcz has quit [Ping timeout: 240 seconds]
GenTooMan has quit [Ping timeout: 245 seconds]
GenTooMan has joined #rust-embedded
fabic has joined #rust-embedded
GenTooMan has quit [Ping timeout: 250 seconds]
<re_irc> <@v​italy.codes:m​atrix.org> HS Probe arrived!!
GenTooMan has joined #rust-embedded
emerent has quit [Ping timeout: 250 seconds]
emerent has joined #rust-embedded
dcz has joined #rust-embedded
fabic has quit [Ping timeout: 250 seconds]
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 252 seconds]
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 250 seconds]
<re_irc> <@b​raincode:m​atrix.org> https://github.com/marcelbuesing/socketcan-isotp/issues/2
fabic has joined #rust-embedded
<re_irc> <@b​igfive:m​atrix.org> Hello everyone, I have been following embedded rust for a few years now. I find many aspects very promising and interesting. Still I never got to really building something with it. Only toyed around with some aspects of the language. As with not too much spare time for this it seems hard for me to find something...
<re_irc> ... to work consistently on and achieve progress. After trying to get "in the game" for a few times over the last year I thought maybe I need to find some project to contribute to that has already something going. In my day job I work a lot with CAN Bus and specially with the CANOpen protocol. As I really like CAN I thought maybe that would...
<re_irc> ... be interesting for me to work on with another set of tools (Rust). As I am a real beginner in actual work in Rust I am not confident to just start something but would rather work in it with other people who are able to give me some guidance. In return I could bring experience from working with CAN / CANopen in practice to the table. I...
<re_irc> ... found https://crates.io/crates/canopen but I could not find a repo of that in it does seem to be not worked on for a long time. I am glad for any input or directions to look for. Thanks
<re_irc> <@c​ome_744:c​onverser.eu> This crate has no associated repository, no documentation and only one published version, 3 years ago… 🤔
<re_irc> <@c​ome_744:c​onverser.eu> Maybe you will find more updated crates here : https://crates.io/search?q=can&sort=recent-downloads
<re_irc> <@b​raincode:m​atrix.org> The implementations of this look the most promising in CAN and Rust space at the moment: https://crates.io/crates/embedded-can
<re_irc> <@b​raincode:m​atrix.org> I've found today that SocketCAN-rs is having some maintainership issues: https://github.com/mbr/socketcan-rs/issues/11
<re_irc> <@j​orgeig:m​atrix.org> braincode: This is a set of traits (like an interface) for building CAN implementations
<re_irc> <@j​orgeig:m​atrix.org> so if you decide to roll your own, it'd be great if you follow it
<re_irc> <@j​orgeig:m​atrix.org> that means that people can switch between implementations without having to rewrite higher level code
<re_irc> <@j​orgeig:m​atrix.org> roll your own or contribute to another project
<re_irc> <@b​raincode:m​atrix.org> bxcan/slcan mentioned on the README for embedded-can, I meant
<re_irc> <@j​orgeig:m​atrix.org> I don't know much about CAN or its Rust implementations so can't help much there - I'm trying to find a CAN implementation for embedded on crates.io but searching for `can` returns a lot of stuff 😅
<re_irc> <@j​orgeig:m​atrix.org> ah yes, bxcan is for STM32 MCUs
<re_irc> <@c​ome_744:c​onverser.eu> In `crates.io` is there any possible filter for to get only `no_std` crates for instance ?
<re_irc> <@j​orgeig:m​atrix.org> @braincode if I understand right, CANopen is a protocol on top of the CAN bus?
<re_irc> <@r​icharddodd:m​atrix.org> Côme: This would be nice
<re_irc> <@j​orgeig:m​atrix.org> if that's the case and you want to get your hands dirty, you could build first a crate that implements the CANopen interface, and then a reference implementation using embedded-hal traits for CAN - if that makes sense?
<re_irc> <@a​damgreig:m​atrix.org> Côme: https://crates.io/categories/no-std is probably the closest thing
<re_irc> <@a​damgreig:m​atrix.org> crates.io can't tell and so many no-std libraries may not set that category, but many do
<re_irc> <@a​damgreig:m​atrix.org> jorgeig: Would it make more sense to build a canopen implementation on top of embedded-can?
<re_irc> <@j​orgeig:m​atrix.org> ah, yes
<re_irc> <@a​damgreig:m​atrix.org> Oh, maybe that's what you meant anyway
<re_irc> <@j​orgeig:m​atrix.org> as I say I literally have no idea about CAN other than that it exists
<re_irc> <@j​orgeig:m​atrix.org> haha
<re_irc> <@a​damgreig:m​atrix.org> But yea, if some canopen crate existed it could support embedded-can as well as the Linux interfaces and so forth, and then users could use it with any embedded driver that implemented embedded-can, such as bxcan for stm32
<re_irc> <@c​ome_744:c​onverser.eu> adamgreig: Cannot use it as a filter when doing a search 😭
<re_irc> <@b​igfive:m​atrix.org> Thanks for All the Response I will take a Look at your suggestions if I am at home
<re_irc> <@f​irefrommoonlight:m​atrix.org> Benjamin Schlegel: We could use an STM32 driver for FD CAN. Ie a complement to https://github.com/stm32-rs/bxcan, but for the newer periph
starblue2 has quit [Ping timeout: 250 seconds]
fabic has quit [Remote host closed the connection]
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 240 seconds]
Rondom_ has quit [Remote host closed the connection]
Rondom has joined #rust-embedded
<re_irc> <@f​irefrommoonlight:m​atrix.org> Do y'all have any recommendations for learning DSP? Interested in realtime audio processing. I want to make scifi augmented reality headphones. (Less-charitably marketed as "Hearing aids for young people")
<re_irc> <@f​irefrommoonlight:m​atrix.org> I'm pretty sure STM32H7 is a clean kill for MCU choice
<re_irc> <@f​irefrommoonlight:m​atrix.org> Thoughts on this Udemy course? https://www.udemy.com/course/arm-cortex-dsp/ Anything else?
<re_irc> <@f​irefrommoonlight:m​atrix.org> I have a STM32H7 dev board (Thanks for the rec on the nucleo guys!), an I2S mic, and closed-ear studio headphone with a jack that plugs into a breadboard.
<re_irc> <@f​irefrommoonlight:m​atrix.org> Also, it looks like most of the material uses a C lib called CMSIS. Not sure if this means I should code in C, make a Rust wrapper lib, FFI etc
<re_irc> <@j​orgeig:m​atrix.org> speaking only from experience in DSPs more than 10 years ago, you want to use the "manufacturer" libraries for the DSP stuff
<re_irc> <@j​orgeig:m​atrix.org> CMSIS is the library built by ARM
<re_irc> <@j​orgeig:m​atrix.org> and they have a DSP part
<re_irc> <@j​orgeig:m​atrix.org> so I would try to build a wrapper around it
<re_irc> <@f​irefrommoonlight:m​atrix.org> Awesome. So maybe start with trivial things like getting the hardware working with a unity transform, then try to wrap CMSIS so I can code in Rust?
<re_irc> <@f​irefrommoonlight:m​atrix.org> Awesome! THank you
<re_irc> <@f​irefrommoonlight:m​atrix.org> Don't want to reinvent any wheels
<re_irc> <@j​orgeig:m​atrix.org> I'm assuming the ARM libraries are the best way to do those ops on ARM cores - it could well be false, but implementing an FFT when you're learning DSP is not fun XD
<re_irc> <@f​irefrommoonlight:m​atrix.org> Hah; thanks!
<re_irc> <@n​ewam:m​atrix.org> Also SIMD, if you have it use it, helps a ton for DSP.
<re_irc> <@f​irefrommoonlight:m​atrix.org> Thank you. I've heard that namedropped, but don't know anything about it. Will research
<re_irc> <@f​irefrommoonlight:m​atrix.org> I'd wager my H7 clock config code is probably broken, but I'm about to find out
<re_irc> <@f​irefrommoonlight:m​atrix.org> Then get into the DSP
<re_irc> <@f​irefrommoonlight:m​atrix.org> Do you think one of the dual-core H7s would be better for this?
<re_irc> <@n​ewam:m​atrix.org> Think of it as acceleration when you need to iterate over an array and perform short, repetitive calculations.
<re_irc> <@n​ewam:m​atrix.org> Which is basically what DSP is 😀
<re_irc> <@n​ewam:m​atrix.org> The ARM libraries probably have everything you ever need though.
<re_irc> <@f​irefrommoonlight:m​atrix.org> Hah, perfect
<re_irc> <@a​damgreig:m​atrix.org> the cmsis libs are fine but i wouldn't worry that much about using them
<re_irc> <@a​damgreig:m​atrix.org> they're more or less just some libraries, there are pure rust libraries for doing FFTs if you want, too, though it might be interesting to benchmark them
<re_irc> <@a​damgreig:m​atrix.org> the stm32h7 is about as powerful as it gets for micocontroller-class dsp devices
<re_irc> <@a​damgreig:m​atrix.org> there's sort of two hard parts, one is working out what dsp you actually want to perform and how it works and so on, and the other is a different problem of making your device do that as fast as it can, which is where the SIMD instructions might help
<re_irc> <@a​damgreig:m​atrix.org> https://crates.io/crates/microfft or https://crates.io/crates/fixed-fft for example might be a lot easier to use than having to wrap the cmsis-dsp fft
<re_irc> <@a​damgreig:m​atrix.org> hah, though of course that's also already done: https://crates.io/crates/cmsis_dsp
<re_irc> <@a​damgreig:m​atrix.org> you might get started by implementing the signal processing on your desktop where it's much much easier to debug and visualise and chart and so on
<re_irc> <@a​damgreig:m​atrix.org> even just doing the algorithms in python or something, if you're familiar with numpy and matplotlib
<re_irc> <@a​damgreig:m​atrix.org> i usually lean too hard into doing everything myself for the learning experience rather than reusing existing libraries, so writing my own fft implementation sounds like great fun and would distract me for a while, heh
<re_irc> <@a​damgreig:m​atrix.org> but if you want to understand what maths is going on and find clever tricks to make it faster or better in your specific implementation i think it's nice
<re_irc> <@a​damgreig:m​atrix.org> dsp is just chock full of clever tricks
<re_irc> <@j​orgeig:m​atrix.org> man I love my studies but I am in no rush to re-implement FFTs and TCP again
<re_irc> <@a​damgreig:m​atrix.org> oh, yea, I think once is enough for that sort of thing :P
<re_irc> <@a​damgreig:m​atrix.org> but doing it that first time is pretty instructive!
<re_irc> <@a​damgreig:m​atrix.org> after that it's more like masochism heh
<re_irc> <@j​orgeig:m​atrix.org> it definitely was, that's true
<re_irc> <@n​ewam:m​atrix.org> That is a good point, rust doesn't have a ton in the way of plotting. matplotlib + python help a ton with visualization.
<re_irc> <@n​ewam:m​atrix.org> For a little rust SDR lib I ended up dumping IQ samples as binary then writing a python script to load the data and display it.
<re_irc> <@n​ewam:m​atrix.org> visualizations are pretty much a requirement for learning DSP, can't easily visualize a waveform by eyeing an array full of numbers.
<re_irc> <@a​damgreig:m​atrix.org> I really like "Understanding Digital Signal Processing" by Richard Lyons if you want a book rec
<re_irc> <@a​damgreig:m​atrix.org> it's got a decent but not too heavy coverage of a lot of DSP topics, and a really great chapter on just lots of good tricks
<re_irc> <@a​damgreig:m​atrix.org> newam: for this I use inline_python and it's _incredible_
<re_irc> <@n​ewam:m​atrix.org> adamgreig: oh, now that's smart.
<re_irc> <@j​orgeig:m​atrix.org> oh wow I did not know that was a thing
<re_irc> <@a​damgreig:m​atrix.org> ```rust
<re_irc> <@a​damgreig:m​atrix.org> #[cfg(feature = "python")]
<re_irc> <@a​damgreig:m​atrix.org> fn plot(c: &C) {
<re_irc> <@a​damgreig:m​atrix.org> let scores = &c.scores;
<re_irc> <@a​damgreig:m​atrix.org> it's amazing lol
<re_irc> <@a​damgreig:m​atrix.org> it _just works_
<re_irc> <@j​orgeig:m​atrix.org> that's amazing
<re_irc> <@a​damgreig:m​atrix.org> (a Mara special)
<re_irc> <@d​irbaio:m​atrix.org> WTF, that looks so cursed
<re_irc> <@n​ewam:m​atrix.org> That is gorgeous compared to the hacks I had. I was generating massive SVGs so I could zoom in on the data.
<re_irc> <@n​ewam:m​atrix.org> Makes me wish that project wasn't finished so I could go back to it.
<re_irc> <@a​damgreig:m​atrix.org> yep i've been absolutely loving it for dsp
<re_irc> <@a​damgreig:m​atrix.org> it's a shame there's nothing as slick as matplotlib already in rust
<re_irc> <@a​damgreig:m​atrix.org> and it still needs nightly atm
<re_irc> <@a​damgreig:m​atrix.org> so I put it behind a "python" featuregate and then `cargo +nightly run --features python` when I want the charting etc
<re_irc> <@f​irefrommoonlight:m​atrix.org> adamgreig: Thank you for the detailed perspective! I suppose you hit the root of the problem, which I ommitted: What I want to do using the DSP. And this will probably evolve over time
<re_irc> <@f​irefrommoonlight:m​atrix.org> I'll check out some native rust libs first
<re_irc> <@f​irefrommoonlight:m​atrix.org> Maybe try this using Python first as you suggested, and not worry about the realtime aspect yet
<re_irc> <@f​irefrommoonlight:m​atrix.org> (Which I assume Python can't hack, or really, anything running on a GPOS can't hack)
<re_irc> <@f​irefrommoonlight:m​atrix.org> (So ironic - you need a slower device to do things faster!)
<re_irc> <@f​irefrommoonlight:m​atrix.org> I'm proficient with Python/Numpy/Scipy etc, and they have loads of libs
<re_irc> <@f​irefrommoonlight:m​atrix.org> I can break this down into 2 problems for now: #1: Get the DAC+headphones (Plus some sort of headphone amp??) + H7 + Mic working with a passthrough. I should be able to do that with the hardware I have on my desk. #2: Use Python to sort out transforms, probably as a record + process + playback later
<re_irc> <@f​irefrommoonlight:m​atrix.org> Problem #1 can probably be sorted with simple breadboarding, and the DAC and SAI peripherals on the STM32H7. I'm proficient with DAC for simple signals, but not with complex, and have no experience with the SAI periph. The STM32H7xx-HAL lib appears to have some support for it in I2S mode, which is what...
<re_irc> ... I want for now
<re_irc> <@f​irefrommoonlight:m​atrix.org> https://www.dspguide.com/pdfbook.htm
dcz has quit [Ping timeout: 240 seconds]
<re_irc> <@c​ome_744:c​onverser.eu> Running `probe-run --chip STM32F407VGTx target/thumbv7em-none-eabi/debug/blinky`
<re_irc> <@c​ome_744:c​onverser.eu> Error: An error specific to a probe type occured
<re_irc> <@c​ome_744:c​onverser.eu> Caused by:
<re_irc> <@c​ome_744:c​onverser.eu> Command failed with status JtagNoDeviceConnected
<re_irc> <@c​ome_744:c​onverser.eu> It seems I have done something really bad just now…
<re_irc> <@c​ome_744:c​onverser.eu> And with `openocd`:
<re_irc> <@c​ome_744:c​onverser.eu> % openocd master
<re_irc> <@c​ome_744:c​onverser.eu> Open On-Chip Debugger 0.11.0
<re_irc> <@c​ome_744:c​onverser.eu> Licensed under GNU GPL v2
<re_irc> <@c​ome_744:c​onverser.eu> 😭😭😭
<re_irc> <@c​ome_744:c​onverser.eu> It was working a few minutes ago… Whyyyy 🤧
<re_irc> <@h​enrik_alser:m​atrix.org> Try with --cennect-under-reset
<re_irc> <@c​ome_744:c​onverser.eu> % cargo run --bin=blinky -- --connect-under-reset master
<re_irc> <@c​ome_744:c​onverser.eu> henrik_alser: ```
<re_irc> <@c​ome_744:c​onverser.eu> Finished dev [unoptimized + debuginfo] target(s) in 0.10s
<re_irc> <@c​ome_744:c​onverser.eu> Running `probe-run --chip STM32F407VGTx target/thumbv7em-none-eabi/debug/blinky --connect-under-reset`
<re_irc> <@c​ome_744:c​onverser.eu> Just wondering, what could cause this?
<re_irc> <@n​ewam:m​atrix.org> Côme: Entering low power modes, turning off clocks for the debug domain.
<re_irc> <@c​ome_744:c​onverser.eu> Hmmm… So the cause is the last program I flashed?
<re_irc> <@n​ewam:m​atrix.org> maybe. There are probably other causes for that, but those two are the ones I encounter the most.
<re_irc> <@c​ome_744:c​onverser.eu> Okay thanks
<re_irc> <@c​ome_744:c​onverser.eu> Could `probe-run` suggest the `--connect-under-reset` flag when this error occurs, a bit like `rustc` notes to fix errors in the code? I think it could help a lot of noobs like me (and be a remainder for the others). I can open an issue here if you think it is the appropriate place...
<re_irc> <@n​ewam:m​atrix.org> That would be a useful diagnostic, yeah. I'm not sure if that message comes from `probe-run` or `probe-rs`, but wouldn't be a wrong first step to file an issue there.
<re_irc> <@n​ewam:m​atrix.org> For `probe-run` it probably makes sense to automatically try `--connect-under-reset` as well? `probe-run` clobbers the state by flashing the target every time, so resetting the target shouldn't be an issue for anyone (famous last words)
<re_irc> <@c​ome_744:c​onverser.eu> It seems it comes from `probe-rs` (file `probe-rs/src/probe/stlink/constants.rs`)
<re_irc> <@c​ome_744:c​onverser.eu> +1 for an automatic try
<re_irc> <@c​ome_744:c​onverser.eu> So I can open an issue for `probe-run` so that it catches the `JtagNoDeviceConnected` error and then test with `--connect-under-reset`?
<re_irc> <@n​ewam:m​atrix.org> That sounds reasonable to me.
<re_irc> <@c​ome_744:c​onverser.eu> Okay thanks, I will do this but I will first try to see if I can do it myself and send a PR
<re_irc> <@a​damgreig:m​atrix.org> newam: connect-under-reset will stop programming ever working on some devices, like nrf52, tho
<re_irc> <@a​damgreig:m​atrix.org> tho I guess... if programming didn't work first time...
<re_irc> <@a​damgreig:m​atrix.org> might as well try with it, lol
<re_irc> <@n​ewam:m​atrix.org> Yeah that's what I figured.
<re_irc> <@a​damgreig:m​atrix.org> might make it sort of mask the problem and cause more confusion later though, dunno
<re_irc> <@a​damgreig:m​atrix.org> it requires the reset line be connected between probe and target, which is often not done if you're hooking stuff up with jumper cables too
<re_irc> <@a​damgreig:m​atrix.org> still I guess it can say "didn't work, trying with reset" and give it a go
<re_irc> <@n​ewam:m​atrix.org> Yeah, I was thinking a really big warning message would make it clear enough; ideally the user should set the flag correctly in the first place.
starblue2 has joined #rust-embedded
<re_irc> <@c​ome_744:c​onverser.eu> So just print a note message to the user, no automatic try?
<re_irc> <@n​ewam:m​atrix.org> I think automatic try isn't a bad idea; but it is debatable.
<re_irc> <@c​ome_744:c​onverser.eu> Now I am wondering: if it can be risky to use it automatically, wouldn't it be risky to suggest beginners who do not know about it to use the flag?
<re_irc> <@n​ewam:m​atrix.org> it's not risky as in it will break anything; just risky in that it may be incorrect for some targets.
<re_irc> <@c​ome_744:c​onverser.eu> So the worst case is that it is a no-op ?
<re_irc> <@a​damgreig:m​atrix.org> and it's kinda annoying to imagine a situation where it's required for some firmware/target but the user keeps running without and it keeps just having to spit out a warning and try again
<re_irc> <@a​damgreig:m​atrix.org> if flashing doesn't work without it, there's no harm in trying with it
<re_irc> <@a​damgreig:m​atrix.org> but usually the actual problem is the user should enable debug-while-in-low-power or something in their own firmware
<re_irc> <@a​damgreig:m​atrix.org> (or avoid entering low power during development etc)
<re_irc> <@a​damgreig:m​atrix.org> it's _required_ when the firmware must disable debug access for some reason, e.g. reusing the pins for something else, or while developing the low-power support, that sort of thing
<re_irc> <@a​damgreig:m​atrix.org> for I guess for 90% of people hitting this problem unexpectedly, it's because they're using RTIC and it defaults to running WFI in the idle loop, putting the chip to a sleep, which typically (e.g. on stm32) disables debug access
<re_irc> <@c​ome_744:c​onverser.eu> Actually in my program I don't know why it happened, I have not used such things explicitly…
<re_irc> <@a​damgreig:m​atrix.org> so the better solution is probably to not do that (in RTIC's case, specify your own idle loop, or whatever)
<re_irc> <@a​damgreig:m​atrix.org> the other common error on stm32 is to use gpioa.moder().write()
<re_irc> <@a​damgreig:m​atrix.org> though I guess in theory that should use the reset value 🤔 anyway it's an easy way to accidentally disable the debug pins
<re_irc> <@c​ome_744:c​onverser.eu> Would it be possible that I unplugged the board at an inappropriate moment?
<re_irc> <@a​damgreig:m​atrix.org> sorry, I'm probably being a bit overly cautious here, I think having probe-run suggest "try using --connect-under-reset, and if that does help, here's a link to an article suggesting why you might need this and how you might avoid it" or something
<re_irc> <@a​damgreig:m​atrix.org> probably not
<re_irc> <@a​damgreig:m​atrix.org> what is in the firmware you flashed?
<re_irc> <@c​ome_744:c​onverser.eu> Hmm at this time I was using stm32f4xx_hal, no RTIC or such things
<re_irc> <@c​ome_744:c​onverser.eu> I do not have the code right now, I shot down the computer
<re_irc> <@c​ome_744:c​onverser.eu> The link option seems good
<re_irc> <@c​ome_744:c​onverser.eu> But it would imply that someone writes something eg in the GH wiki of probe-run
<re_irc> <@c​ome_744:c​onverser.eu> And I do not have the knowledge to do this
<re_irc> <@a​damgreig:m​atrix.org> even just suggesting to try that option is probably more helpful than nothing
<re_irc> <@a​damgreig:m​atrix.org> you could see what the probe-run maintainers think about having it retry with it automatically
<re_irc> <@c​ome_744:c​onverser.eu> First I'll try to print a note, and then in the PR (if I succeed) or issue (if I try and fail) I will mention the different ideas mentionned in this channel.
<re_irc> <@c​ome_744:c​onverser.eu> Thanks!
<re_irc> <@c​ome_744:c​onverser.eu> (And maybe the automatic use of the flag does not exclude the possibility to print a warning and a link explaining how to avoid the warning)
emerent has quit [Ping timeout: 250 seconds]
emerent has joined #rust-embedded