cr19011 has joined #rust-embedded
<re_irc> <@j​2j4l:m​atrix.org> dkhayes117: AFAIK, BLE and Bluetooth in general in nrf is still far from ready...
cr19011 is now known as cr1901
emerent has quit [Ping timeout: 256 seconds]
emerent has joined #rust-embedded
starblue has joined #rust-embedded
starblue3 has quit [Ping timeout: 272 seconds]
<re_irc> <@t​herealprof:m​atrix.org> nRF is certainly a contender, something from STM32 like an F4 would be another choice.
<re_irc> <@l​achlansneff:m​atrix.org> This isn't exactly an embedded-rust question, but if I wanted to store logs/data on a storage device that I could remove and look at with a computer, would an SD card be a reasonable choice?
<re_irc> <@l​achlansneff:m​atrix.org> Does embedded rust have a good sd card library?
<re_irc> <@t​herealprof:m​atrix.org> Yes and yes. I don't think there're a lot other choices?
<re_irc> <@t​herealprof:m​atrix.org> https://crates.io/crates/embedded-sdmmc
<re_irc> <@l​achlansneff:m​atrix.org> Yeah that only other thing I can think of is storing it in flash, and then report over bluetooth or something later on.
<re_irc> <@l​achlansneff:m​atrix.org> I guess that doesn't really quite fit in the criteria I stated
<re_irc> <@l​achlansneff:m​atrix.org> Well, basically what I'm planning on doing is a thrust-vector control system for a hobby rocket, so I need something that can withstand the vibration and impacts.
<re_irc> <@9​names:m​atrix.org> could also implement USB MSC host on your embedded device, but SD card would be easier
<re_irc> <@a​damgreig:m​atrix.org> SD card will probably survive vibes OK, but you can buy SMD devices that are electrically SD cards, which would be a lot more robust
<re_irc> <@9​names:m​atrix.org> ah yeah, vibration makes things tricky. i wonder if the connector on the pine64 eMMC module would be more vibration-proof
<re_irc> <@a​damgreig:m​atrix.org> i once lost a micro SD card in black rock desert when my hobby rocket tore itself to pieces at mach 3 and the airflow ripped the µsd holder off the pcb
<re_irc> <@a​damgreig:m​atrix.org> and spent like 12 hours scouring the desert floor for this micro sd card
<re_irc> <@l​achlansneff:m​atrix.org> adamgreig: How do you grab data off them?
<re_irc> <@9​names:m​atrix.org> did you find it?
<re_irc> <@a​damgreig:m​atrix.org> no, rip
<re_irc> <@9​names:m​atrix.org> :'(
<re_irc> <@a​damgreig:m​atrix.org> Lachlan Sneff: best bet is probably usb/rf via the mcu
<re_irc> <@a​damgreig:m​atrix.org> but it's still a lot faster to write than onboard flash or spi flash
<re_irc> <@a​damgreig:m​atrix.org> and you can use your mcu's sd card peripheral to interface (assuming it has one) which is v fast
<re_irc> <@l​achlansneff:m​atrix.org> Ah, interesting
<re_irc> <@l​achlansneff:m​atrix.org> I think I'll probably use a regular sd card to start with
<re_irc> <@l​achlansneff:m​atrix.org> but the SMD "SD cards" is a good idea
<re_irc> <@l​achlansneff:m​atrix.org> I'm not doing anything too powerful
<re_irc> <@a​damgreig:m​atrix.org> yea, if you're not a dummy like me and keep the pcb inside the rocket at all times it should be fine
<re_irc> <@l​achlansneff:m​atrix.org> Jeez, wow
<re_irc> <@l​achlansneff:m​atrix.org> That's a girthy hobby rocket
<re_irc> <@a​damgreig:m​atrix.org> i had a second avionics, same pcb, that did manage to hold onto its sd card, and that one wrote write until the wiring was all ripped apart etc etc, so vibes weren't the issue
<re_irc> <@t​herealprof:m​atrix.org> SD cards built-in flash controllers. For raw flash you have to do wear levelling and magic yourself.
<re_irc> <@t​herealprof:m​atrix.org> That makes SD cards very interesting for data logging applications.
<re_irc> <@a​damgreig:m​atrix.org> therealprof: yea, I'm talking about these niche solder-down SD cards in like SOIC packages
<re_irc> <@a​damgreig:m​atrix.org> rather than raw flash
<re_irc> <@t​herealprof:m​atrix.org> Also there're "enhanced specs" industrial versions.
<re_irc> <@t​herealprof:m​atrix.org> I was refererring to an earlier message from Lachlan Sneff.
<re_irc> <@a​damgreig:m​atrix.org> things to beware of with sd cards: many will occasionally need to pause writes while they do housekeeping, maybe for 100ms, so keep a decent buffer on your side
<re_irc> <@t​herealprof:m​atrix.org> adamgreig: You mean eMMC probably?
<re_irc> <@a​damgreig:m​atrix.org> no
<re_irc> <@a​damgreig:m​atrix.org> distinct thing
<re_irc> <@a​damgreig:m​atrix.org> emmc is more of a pain due to typically large bga packages and higher pin count
<re_irc> <@t​herealprof:m​atrix.org> Ah okay. eMMC would also be an option. 😉
<re_irc> <@a​damgreig:m​atrix.org> but yea i think you will be totally fine with µSD
<re_irc> <@l​achlansneff:m​atrix.org> Say I was using RTIC. How should I go about writing the logs to an SD card during idle times?
<re_irc> <@l​achlansneff:m​atrix.org> Would I have to worry about a write being interrupted by other things?
<re_irc> <@a​damgreig:m​atrix.org> you'd usually have the idle task fill a write-sized buffer (maybe 512b or 4k or something), then trigger a DMA transfer when it's ready
<re_irc> <@a​damgreig:m​atrix.org> it won't all be happy DMA because of managing the filesystem and so forth, assuming you do use a filesystem
<re_irc> <@a​damgreig:m​atrix.org> but anything timing-critical will use the mcu's sd card peripheral (or spi interface)
<re_irc> <@a​damgreig:m​atrix.org> so shouldn't matter if it's interrupted
<re_irc> <@l​achlansneff:m​atrix.org> I don't think the mcu I'd be using has an SDMMC
<re_irc> <@a​damgreig:m​atrix.org> (probably you use some queues from heapless or bbqueue or something to shuttle data from the other tasks into the idle task's buffer)
<re_irc> <@t​herealprof:m​atrix.org> therealprof: I take that back, you're right, it's a pain and not suitable; I was thinking of something else but can't remember what it was called.
<re_irc> <@a​damgreig:m​atrix.org> ah, shame, it's a lot quicker, but spi works too and basically same deal
<re_irc> <@l​achlansneff:m​atrix.org> If I don't use a filesystem, how would I go about reading it later on?
<re_irc> <@a​damgreig:m​atrix.org> computer can read it raw
<re_irc> <@a​damgreig:m​atrix.org> obviously more of a pain
<re_irc> <@l​achlansneff:m​atrix.org> I'd have to mount it as a block device or somethin?
<re_irc> <@a​damgreig:m​atrix.org> on linux it's the difference between "mount -t vfat /dev/sda1 /mnt/sdcard" and then "cat /mnt/sdcard/log.txt" and just "cat /dev/sda"
<re_irc> <@l​achlansneff:m​atrix.org> Gotcha
<re_irc> <@a​damgreig:m​atrix.org> you wouldn't really need to mount it at all, I guess, or maybe in loopback for perms or something
<re_irc> <@f​irefrommoonlight:m​atrix.org> j2j4l: I was surprised about this, given that's the chip's main target
<re_irc> <@a​damgreig:m​atrix.org> I would probably try and use a filesystem, though I haven't tried in rust I understand they exist and it will make life easier for not much overhead
<re_irc> <@9​names:m​atrix.org> I've used a "fixed" filesystem, with a hardcoded FAT and a single large file so you can do raw read/write from the micro without any filesystem
<re_irc> <@a​damgreig:m​atrix.org> nice, that's an option too
<re_irc> <@a​damgreig:m​atrix.org> if only i'd done that rocket in rust back in 2014, maybe it would have survived the aerodynamic loading better 🤔
<re_irc> <@t​halesfragoso:m​atrix.org> embedded-sdmmc(-rs) uses 512 bytes read/writes, so if you use DMA for that you can sustain some interruptions
<re_irc> <@t​herealprof:m​atrix.org> Yeah, FAT is pretty much the defacto standard for such applications.
<re_irc> <@t​herealprof:m​atrix.org> Trivial to implement and ubiquitously supported.
<re_irc> <@a​damgreig:m​atrix.org> incidentally does anyone have any clue about https://github.com/rust-embedded/embedonomicon/runs/3267304355#step:10:118
<re_irc> <@t​halesfragoso:m​atrix.org> Although if using embedded-dma that won't probably play nice with embedded-sdmmc
<re_irc> <@a​damgreig:m​atrix.org> it's been cursed/haunted from the start, and now nothing makes sense
<re_irc> <@l​achlansneff:m​atrix.org> I think I'll try a hard-coded fat partition then
<re_irc> <@l​achlansneff:m​atrix.org> adamgreig: Were you doing any sort of guidance, or was that just recording telemetry/
<re_irc> <@a​damgreig:m​atrix.org> Lachlan Sneff: https://crates.io/crates/embedded-sdmmc already does FAT for you aiui
<re_irc> <@t​halesfragoso:m​atrix.org> I have a fork of embedded-sdmmc working with a embassy driver if async floats your boat
<re_irc> <@j​2j4l:m​atrix.org> therealprof: Fragmentation can be real pain. Given you write logs in small chunks. But if it's for a short-lived rocket, than should be ok 🙂
<re_irc> <@a​damgreig:m​atrix.org> somewhere in between, it was operating the various pyrotechnic recovery systems so did IMU and online state estimation and so on, but no active control of trajectory
<re_irc> <@a​damgreig:m​atrix.org> much harder to get permission to launch active guided rockets at this scale
<re_irc> <@9​names:m​atrix.org> j2j4l: that's why the fixed option is good. single contiguous file at a fixed offset, no need for your MCU to ever read/update the FAT while logging
<re_irc> <@l​achlansneff:m​atrix.org> Actually, just thought of this: what about writing data to a flash chip, and then dumping that onto the sd card as a well-behaved file at landing?
<re_irc> <@t​halesfragoso:m​atrix.org> firefrommoonlight: The hardware part is easy, the hard part is the stack
<re_irc> <@t​halesfragoso:m​atrix.org> but we do have rubble and nrf-softdevice
<re_irc> <@a​damgreig:m​atrix.org> in my experience (using a 4-bit wide sd card interface and sd peripheral, not SPI), there was more than enough time to manage the FS and write out to the file, the write bandwidth is pretty high
<re_irc> <@l​achlansneff:m​atrix.org> Well, doesn't hurt to try
<re_irc> <@a​damgreig:m​atrix.org> you could also just write to a single large pre-allocated file at runtime and then after the flight read from that and write back to a small file, without needing a second flash chip
<re_irc> <@l​achlansneff:m​atrix.org> What's the danger of corrupting the file system if the card pops out?
<re_irc> <@a​damgreig:m​atrix.org> I guess a raw flash IC would have more deterministic write timings though
<re_irc> <@a​damgreig:m​atrix.org> eh
<re_irc> <@a​damgreig:m​atrix.org> assuming you tidy up after each block, you might lose the final block, but it was probably only half written anyway, and you can probably recover it manually if you really need to later
<re_irc> <@a​damgreig:m​atrix.org> so i wouldn't expect it to be an issue
<re_irc> <@l​achlansneff:m​atrix.org> Awesome. This is great info
<re_irc> <@l​achlansneff:m​atrix.org> Thank you everyone
<re_irc> <@l​achlansneff:m​atrix.org> One more thing: Where do y'all suggest ordering pcbs that can do PnP at the factory?
<re_irc> <@l​achlansneff:m​atrix.org> I normally order from jlcpcb, but the shipping time is very long
<re_irc> <@a​damgreig:m​atrix.org> can you just pay them more? I usually get <=1 week shipping from them to the UK, dunno what it's like for you
<re_irc> <@a​damgreig:m​atrix.org> suspect you'll pay a bunch more for locally assembled boards
<re_irc> <@l​achlansneff:m​atrix.org> Ah, you’re probably right
<re_irc> <@l​achlansneff:m​atrix.org> Well, I have the next week off to design the board and the TVC system itself, so I’m sure I’ll have a bunch of questions then
<re_irc> <@a​damgreig:m​atrix.org> nice!
<re_irc> <@a​damgreig:m​atrix.org> what sort of motors?
<re_irc> <@l​achlansneff:m​atrix.org> Probably just some metal-geared servos from adafruit
<re_irc> <@l​achlansneff:m​atrix.org> There’s not a lot of force here
<re_irc> <@a​damgreig:m​atrix.org> delta arm sort of thing?
<re_irc> <@l​achlansneff:m​atrix.org> Yes, if I’m visualizing what you mean by that correctly
<re_irc> <@l​achlansneff:m​atrix.org> I just decided to do this project this morning, so it’s still pretty fluid
<re_irc> <@a​damgreig:m​atrix.org> heh, fun
<re_irc> <@a​damgreig:m​atrix.org> sounds fun!
<re_irc> <@l​achlansneff:m​atrix.org> I find that I need to immediately get as much done as possible when I start or I just keep putting it off forever haha
<re_irc> <@l​achlansneff:m​atrix.org> That’s what happened to my atomic force microscope project
<re_irc> <@l​achlansneff:m​atrix.org> I designed some boards and got them shipped, and learned how to program FPGAs, but the early phases took so long that I lost interest
<re_irc> <@a​damgreig:m​atrix.org> is that how you ended up writing a gtkwave replacement?
<re_irc> <@l​achlansneff:m​atrix.org> Yeah
<re_irc> <@l​achlansneff:m​atrix.org> I’ve been periodically working on that though
<re_irc> <@l​achlansneff:m​atrix.org> I got fed up with gtkwave and decided that the world needed something better
<re_irc> <@l​achlansneff:m​atrix.org> Of course I haven’t gotten it in a usable state yet
<re_irc> <@l​achlansneff:m​atrix.org> I keep rewriting how it stores and processes value changes
fabic has quit [Ping timeout: 258 seconds]
emerent has quit [Remote host closed the connection]
<re_irc> <@l​achlansneff:m​atrix.org> Ah, turns out the MCU I have does have an SDIO peripheral
emerent has joined #rust-embedded
<re_irc> <@l​achlansneff:m​atrix.org> Unfortunately, there’s no higher-level api for DMA it seems in the hal impl
<re_irc> <@h​enrik_alser:m​atrix.org> Lachlan Sneff: Where are you located? In europe i’ve been using Aisler lately with great success
<re_irc> <@l​achlansneff:m​atrix.org> Eastish Coast of the US
fabic has joined #rust-embedded
<re_irc> <@h​enrik_alser:m​atrix.org> Lachlan Sneff: CircuitHub?
<re_irc> <@l​achlansneff:m​atrix.org> I’ll definitely try that out
<re_irc> <@h​enrik_alser:m​atrix.org> 🙌
fabic has quit [Ping timeout: 258 seconds]
<re_irc> <@h​enrik_alser:m​atrix.org> Heard good things about MacroFab too
<re_irc> <@j​orgeig:m​atrix.org> Zuubek: I'm in the same boat as you, and I can tell you that RTIC makes things way simpler as a Rust beginner!
<re_irc> <@j​orgeig:m​atrix.org> started writing code to handle interrupts, mutexes for shared resources, etc. and while it helped me learn, it wasn't sustainable for project use
<re_irc> <@j​orgeig:m​atrix.org> well it was, it's how I always did it in C, I just didn't wanna bother with it while also learning Rust haha
<re_irc> <@r​yan-summers:m​atrix.org> I'm very happy to allow RTIC to remove all the boilerplate from my code :)
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 252 seconds]
neceve has joined #rust-embedded
fabic has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
<re_irc> <@s​tu_:m​atrix.org> Hey people 👋,
<re_irc> <@s​tu_:m​atrix.org> We are currently working on an RTOS for the Nintendo Switch, which is based on a Cortex-A processor, so we want a good and "rusty" way of interacting with the hardware.
<re_irc> <@s​tu_:m​atrix.org> We already tried using the `cortex-a` crate, however, it is really thin and doesn't give us much of an advantage.
<re_irc> <@s​tu_:m​atrix.org> Thus we decided that we will write our own `cortex-a` like crate, with abstractions for everything that the Cortex-A has to offer.
<re_irc> <@t​herealprof:m​atrix.org> stu_ That sounds most excellent and exciting!
<re_irc> <@t​herealprof:m​atrix.org> Do you have anything to look at already?
<re_irc> <@t​herealprof:m​atrix.org> Have you sketched out a plan for cortex-a already?
<re_irc> <@s​tu_:m​atrix.org> Not yet, as we just started with the project. In a few days we will definitely have something to look at.
<re_irc> <@s​tu_:m​atrix.org> We are currently thinking much about how to structure the crate and what APIs we can provide and how they should look like
tokomak has quit [Ping timeout: 258 seconds]
<re_irc> <@t​herealprof:m​atrix.org> I think a great way to drive this forward is if you had a GH issue somewhere with some context and information. Then can put it on agenda for the WG meetings (happening each Tuesday 20:00 CEST here and everyone is invited to particapte) and have a discussion to get some opinions and maybe come up with a...
<re_irc> ... roadmap.
<re_irc> <@s​tu_:m​atrix.org> Alright, thank you!
<re_irc> <@s​tu_:m​atrix.org> Should the issue be in the `wg` repository or `cortex-a`?
<re_irc> <@t​herealprof:m​atrix.org> `cortex-a` sounds good. At least that will also alert the Cortex-A team which usually is not chatting here.
<re_irc> <@t​herealprof:m​atrix.org> If you would be able to link the issue here (once created) that'd be great, otherwise the active people would miss it. ;)
<re_irc> <@s​tu_:m​atrix.org> Will do that!
<re_irc> <@s​tu_:m​atrix.org> I'm pretty sure that we will also have a general structure of the crate ready by Thursday.
<re_irc> <@i​_am_the_carl:m​atrix.org> I used Tokio on desktop recently and loved how simple it was to get high efficiency IO with a single thread.
<re_irc> <@i​_am_the_carl:m​atrix.org> I was wondering, has anyone used something like Tokio on an embedded device?
<re_irc> <@i​_am_the_carl:m​atrix.org> I feel like it could work if you just leave out the standard library and runtime.
<re_irc> <@t​halesfragoso:m​atrix.org> i_am_the_carl: Does embassy count ?
<re_irc> <@i​_am_the_carl:m​atrix.org> I didn't know it was a thing until you mentioned it.
<re_irc> <@i​_am_the_carl:m​atrix.org> https://github.com/embassy-rs/embassy
<re_irc> <@i​_am_the_carl:m​atrix.org> This looks really nice. Thank you for pointing me that way.
<re_irc> <@t​halesfragoso:m​atrix.org> No problem, there's also TockOS
<re_irc> <@t​halesfragoso:m​atrix.org> But I haven't used it
<re_irc> <@i​_am_the_carl:m​atrix.org> It looks like it's still pretty early in development but that's most of the Rust embedded ecosystem so I'm fine with that.
<re_irc> <@i​_am_the_carl:m​atrix.org> Honestly your "unstable" features are more stable than some "stable" features from companies that charge far too much for their embedded compilers.
<re_irc> <@t​halesfragoso:m​atrix.org> And GAT won't be incomplete anymore :)
<re_irc> <@i​_am_the_carl:m​atrix.org> GAT?
<re_irc> <@t​halesfragoso:m​atrix.org> Generic Associated Types
<re_irc> <@t​halesfragoso:m​atrix.org> One of the unstable features used in some places in the embassy ecosystem
GenTooMan has quit [Ping timeout: 258 seconds]
GenTooMan has joined #rust-embedded
fabic has quit [Ping timeout: 258 seconds]
starblue has quit [Ping timeout: 258 seconds]
inara has joined #rust-embedded
inara has quit [Quit: Leaving]
inara has joined #rust-embedded
inara has quit [Client Quit]
inara has joined #rust-embedded
hifi has joined #rust-embedded
starblue has joined #rust-embedded
starblue has quit [Ping timeout: 245 seconds]
starblue has joined #rust-embedded
neceve has quit [Ping timeout: 256 seconds]
<re_irc> <@b​raincode:m​atrix.org> i_am_the_carl: https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html