cr19011 has joined #rust-embedded
<re_irc> <@j​2j4l:m​> 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​> nRF is certainly a contender, something from STM32 like an F4 would be another choice.
<re_irc> <@l​achlansneff:m​> 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​> Does embedded rust have a good sd card library?
<re_irc> <@t​herealprof:m​> Yes and yes. I don't think there're a lot other choices?
<re_irc> <@t​herealprof:m​>
<re_irc> <@l​achlansneff:m​> 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​> I guess that doesn't really quite fit in the criteria I stated
<re_irc> <@l​achlansneff:m​> 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​> could also implement USB MSC host on your embedded device, but SD card would be easier
<re_irc> <@a​damgreig:m​> 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​> 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​> 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​> and spent like 12 hours scouring the desert floor for this micro sd card
<re_irc> <@l​achlansneff:m​> adamgreig: How do you grab data off them?
<re_irc> <@9​names:m​> did you find it?
<re_irc> <@a​damgreig:m​> no, rip
<re_irc> <@9​names:m​> :'(
<re_irc> <@a​damgreig:m​> Lachlan Sneff: best bet is probably usb/rf via the mcu
<re_irc> <@a​damgreig:m​> but it's still a lot faster to write than onboard flash or spi flash
<re_irc> <@a​damgreig:m​> 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​> Ah, interesting
<re_irc> <@l​achlansneff:m​> I think I'll probably use a regular sd card to start with
<re_irc> <@l​achlansneff:m​> but the SMD "SD cards" is a good idea
<re_irc> <@l​achlansneff:m​> I'm not doing anything too powerful
<re_irc> <@a​damgreig:m​> 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​> Jeez, wow
<re_irc> <@l​achlansneff:m​> That's a girthy hobby rocket
<re_irc> <@a​damgreig:m​> 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​> SD cards built-in flash controllers. For raw flash you have to do wear levelling and magic yourself.
<re_irc> <@t​herealprof:m​> That makes SD cards very interesting for data logging applications.
<re_irc> <@a​damgreig:m​> therealprof: yea, I'm talking about these niche solder-down SD cards in like SOIC packages
<re_irc> <@a​damgreig:m​> rather than raw flash
<re_irc> <@t​herealprof:m​> Also there're "enhanced specs" industrial versions.
<re_irc> <@t​herealprof:m​> I was refererring to an earlier message from Lachlan Sneff.
<re_irc> <@a​damgreig:m​> 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​> adamgreig: You mean eMMC probably?
<re_irc> <@a​damgreig:m​> no
<re_irc> <@a​damgreig:m​> distinct thing
<re_irc> <@a​damgreig:m​> emmc is more of a pain due to typically large bga packages and higher pin count
<re_irc> <@t​herealprof:m​> Ah okay. eMMC would also be an option. 😉
<re_irc> <@a​damgreig:m​> but yea i think you will be totally fine with µSD
<re_irc> <@l​achlansneff:m​> 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​> Would I have to worry about a write being interrupted by other things?
<re_irc> <@a​damgreig:m​> 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​> 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​> but anything timing-critical will use the mcu's sd card peripheral (or spi interface)
<re_irc> <@a​damgreig:m​> so shouldn't matter if it's interrupted
<re_irc> <@l​achlansneff:m​> I don't think the mcu I'd be using has an SDMMC
<re_irc> <@a​damgreig:m​> (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​> 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​> ah, shame, it's a lot quicker, but spi works too and basically same deal
<re_irc> <@l​achlansneff:m​> If I don't use a filesystem, how would I go about reading it later on?
<re_irc> <@a​damgreig:m​> computer can read it raw
<re_irc> <@a​damgreig:m​> obviously more of a pain
<re_irc> <@l​achlansneff:m​> I'd have to mount it as a block device or somethin?
<re_irc> <@a​damgreig:m​> 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​> Gotcha
<re_irc> <@a​damgreig:m​> 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​> j2j4l: I was surprised about this, given that's the chip's main target
<re_irc> <@a​damgreig:m​> 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​> 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​> nice, that's an option too
<re_irc> <@a​damgreig:m​> 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​> 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​> Yeah, FAT is pretty much the defacto standard for such applications.
<re_irc> <@t​herealprof:m​> Trivial to implement and ubiquitously supported.
<re_irc> <@a​damgreig:m​> incidentally does anyone have any clue about
<re_irc> <@t​halesfragoso:m​> Although if using embedded-dma that won't probably play nice with embedded-sdmmc
<re_irc> <@a​damgreig:m​> it's been cursed/haunted from the start, and now nothing makes sense
<re_irc> <@l​achlansneff:m​> I think I'll try a hard-coded fat partition then
<re_irc> <@l​achlansneff:m​> adamgreig: Were you doing any sort of guidance, or was that just recording telemetry/
<re_irc> <@a​damgreig:m​> Lachlan Sneff: already does FAT for you aiui
<re_irc> <@t​halesfragoso:m​> I have a fork of embedded-sdmmc working with a embassy driver if async floats your boat
<re_irc> <@j​2j4l:m​> 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​> 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​> much harder to get permission to launch active guided rockets at this scale
<re_irc> <@9​names:m​> 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​> 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​> firefrommoonlight: The hardware part is easy, the hard part is the stack
<re_irc> <@t​halesfragoso:m​> but we do have rubble and nrf-softdevice
<re_irc> <@a​damgreig:m​> 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​> Well, doesn't hurt to try
<re_irc> <@a​damgreig:m​> 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​> What's the danger of corrupting the file system if the card pops out?
<re_irc> <@a​damgreig:m​> I guess a raw flash IC would have more deterministic write timings though
<re_irc> <@a​damgreig:m​> eh
<re_irc> <@a​damgreig:m​> 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​> so i wouldn't expect it to be an issue
<re_irc> <@l​achlansneff:m​> Awesome. This is great info
<re_irc> <@l​achlansneff:m​> Thank you everyone
<re_irc> <@l​achlansneff:m​> One more thing: Where do y'all suggest ordering pcbs that can do PnP at the factory?
<re_irc> <@l​achlansneff:m​> I normally order from jlcpcb, but the shipping time is very long
<re_irc> <@a​damgreig:m​> 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​> suspect you'll pay a bunch more for locally assembled boards
<re_irc> <@l​achlansneff:m​> Ah, you’re probably right
<re_irc> <@l​achlansneff:m​> 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​> nice!
<re_irc> <@a​damgreig:m​> what sort of motors?
<re_irc> <@l​achlansneff:m​> Probably just some metal-geared servos from adafruit
<re_irc> <@l​achlansneff:m​> There’s not a lot of force here
<re_irc> <@a​damgreig:m​> delta arm sort of thing?
<re_irc> <@l​achlansneff:m​> Yes, if I’m visualizing what you mean by that correctly
<re_irc> <@l​achlansneff:m​> I just decided to do this project this morning, so it’s still pretty fluid
<re_irc> <@a​damgreig:m​> heh, fun
<re_irc> <@a​damgreig:m​> sounds fun!
<re_irc> <@l​achlansneff:m​> 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​> That’s what happened to my atomic force microscope project
<re_irc> <@l​achlansneff:m​> 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​> is that how you ended up writing a gtkwave replacement?
<re_irc> <@l​achlansneff:m​> Yeah
<re_irc> <@l​achlansneff:m​> I’ve been periodically working on that though
<re_irc> <@l​achlansneff:m​> I got fed up with gtkwave and decided that the world needed something better
<re_irc> <@l​achlansneff:m​> Of course I haven’t gotten it in a usable state yet
<re_irc> <@l​achlansneff:m​> 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​> Ah, turns out the MCU I have does have an SDIO peripheral
emerent has joined #rust-embedded
<re_irc> <@l​achlansneff:m​> Unfortunately, there’s no higher-level api for DMA it seems in the hal impl
<re_irc> <@h​enrik_alser:m​> Lachlan Sneff: Where are you located? In europe i’ve been using Aisler lately with great success
<re_irc> <@l​achlansneff:m​> Eastish Coast of the US
fabic has joined #rust-embedded
<re_irc> <@h​enrik_alser:m​> Lachlan Sneff: CircuitHub?
<re_irc> <@l​achlansneff:m​> I’ll definitely try that out
<re_irc> <@h​enrik_alser:m​> 🙌
fabic has quit [Ping timeout: 258 seconds]
<re_irc> <@h​enrik_alser:m​> Heard good things about MacroFab too
<re_irc> <@j​orgeig:m​> 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​> 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​> 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​> 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​> Hey people 👋,
<re_irc> <@s​tu_:m​> 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​> 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​> 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​> stu_ That sounds most excellent and exciting!
<re_irc> <@t​herealprof:m​> Do you have anything to look at already?
<re_irc> <@t​herealprof:m​> Have you sketched out a plan for cortex-a already?
<re_irc> <@s​tu_:m​> 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​> 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​> 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​> Alright, thank you!
<re_irc> <@s​tu_:m​> Should the issue be in the `wg` repository or `cortex-a`?
<re_irc> <@t​herealprof:m​> `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​> 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​> Will do that!
<re_irc> <@s​tu_:m​> 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​> 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​> I was wondering, has anyone used something like Tokio on an embedded device?
<re_irc> <@i​_am_the_carl:m​> I feel like it could work if you just leave out the standard library and runtime.
<re_irc> <@t​halesfragoso:m​> i_am_the_carl: Does embassy count ?
<re_irc> <@i​_am_the_carl:m​> I didn't know it was a thing until you mentioned it.
<re_irc> <@i​_am_the_carl:m​>
<re_irc> <@i​_am_the_carl:m​> This looks really nice. Thank you for pointing me that way.
<re_irc> <@t​halesfragoso:m​> No problem, there's also TockOS
<re_irc> <@t​halesfragoso:m​> But I haven't used it
<re_irc> <@i​_am_the_carl:m​> 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​> 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​> And GAT won't be incomplete anymore :)
<re_irc> <@i​_am_the_carl:m​> GAT?
<re_irc> <@t​halesfragoso:m​> Generic Associated Types
<re_irc> <@t​halesfragoso:m​> 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​> i_am_the_carl: