IlPalazzo-ojiisa has quit [Remote host closed the connection]
<re_irc>
<@thejpster:matrix.org> I cleaned up a bunch of outstanding rust-embedded-community/embedded-sdmmc PRs. Apologies to anyone whose PR we didn't get merged before I came back to the project and broke everything.
<re_irc>
<@thejpster:matrix.org> Volunteers for stewarding the crates in rust-embedded-community are always welcome :)
<re_irc>
<@devakiran:matrix.org> hi i am new to rust in esp32
<re_irc>
<@devakiran:matrix.org> can i use eps-wroom32 for this
<re_irc>
<@firefrommoonlight:matrix.org> I dunno I guess
<re_irc>
<@firefrommoonlight:matrix.org> ESP32 has a v confusing product line
<re_irc>
<@firefrommoonlight:matrix.org> But they're all p much the same!
<re_irc>
<@firefrommoonlight:matrix.org> Sometimes they even use different-named footprints that are actually the same
<re_irc>
<@firefrommoonlight:matrix.org> Learn to lurve it
<re_irc>
<@firefrommoonlight:matrix.org> I am assuming ESP-WROOM32 is like all the others
IlPalazzo-ojiisa has joined #rust-embedded
<re_irc>
<@fuse117:matrix.org> can someone provide an example of rust code for a device that is a SPI slave?
<re_irc>
<@fuse117:matrix.org> i have never developed the slave side. im thinking of something like a server that waits for commands, executes those commands, and possibly responds to a master
<re_irc>
<@thejpster:matrix.org> with a command / response protocol, runs on an STM32F0. Only goes up to about 4 MHz bus clock though - I should be using DMA really.
<re_irc>
<@thejpster:matrix.org> The protocol is designed to have a fixed size first packet, so you can receive it with DMA, and then an optional variable sized second packet (where the first packet told you how big it's going to be).
<re_irc>
<@thejpster:matrix.org> I also would generally avoid the old Mxxx and Sxxx terminology. Controller and Peripheral, or Initiator and Recipient work.
<cr1901>
M/S was also removed from the latest I2C spec. So NXP seems to agree
<re_irc>
<@drebbe:matrix.org> Sad we are changing terminology when it doesn't even correlate to the thing that people take offense to.
<re_irc>
<@juliand:fehler-in-der-matrix.de> drebbe: Well, if people are offended by this terminology I personally don't have a problem to change it. It would be helpful though, to replace it with some consistent terminology to avoid confusion. (Maybe at least across the rust ecosystem?) Are there any guidelines for this atm?
<re_irc>
<@cajt:matrix.org> They missed the oportunity to actually improve ther terminology, on the protocol level there would be a better option: initiator and responder ... and suddenly everyone has an idea what going on.
<re_irc>
<@drebbe:matrix.org> : Consistency would be amazing, change just to change isn't very intelligent IMO
<re_irc>
<@drebbe:matrix.org> : I don't think anyone was ever confused about what master and slave mean in computer science. If they were they probably needed a new field of study, lol.
<re_irc>
<@cajt:matrix.org> drebbe: no, probably not. But the modifications taken are often bad and confusing for various reasons. The SPI naming miso mosi for example fixed the context problem with rx/tx, as probably everyone long enough in embedded expierienced at one time. That was an improvement, many of the later choices, not so much
<re_irc>
<@cajt:matrix.org> The stuff ARM picked was easies to remember, if one knew the context: keep M/S abbreviations consistend, so it kinda remains master and slave.
<re_irc>
<@drebbe:matrix.org> : TX/RX has caused the industry probably billions in mistakes, lol. Let's change that first.
dc740 has joined #rust-embedded
<re_irc>
<@robgal519:matrix.org> Hi, I have an application running on stm32f103. I want to save some flags to the end of the flash build in to the SoC. How to do this ?
<re_irc>
I tried using PAC to gain access to flash, and I was able to read the flash, and even write some bytes ( but I started getting some errors.) I generally do not like this approach, because the build system does not see my modifications, and if my application grows, I can accidentally overwrite the application.
<re_irc>
so my question is How to shrink the FLASH region, and use the freed space for separate None Volatile Storage accessible from the application ?
<re_irc>
<@dirbaio:matrix.org> reduce FLASH in memory.x
<re_irc>
<@dirbaio:matrix.org> so the reserved space is guaranteed to not be used (linking will fail if you add too much code, instead of using the reserved space)
<re_irc>
<@robgal519:matrix.org> ok, I can try this. BTW is there some standard way of storing persistent application settings for embedded devices written in Rust ? I just need to store some configuration values, that most likely will be done only few times in the lifetime of the device, so flash usage is not an issue (It will also be just a few Bytes). I'm wondering if I try to invent the wheel, or is there a better solution for storing such data...
<re_irc>
... without external EEPROM chip ?
<re_irc>
<@dirbaio:matrix.org> simpler is better :)
<re_irc>
If the dataset fits in RAM, you could read/write it all at once. Either making it repr(C) and transmuting, or serializing it with some compact serde flavor such as postcard
<re_irc>
<@dirbaio:matrix.org> if it doesn't then there's
<re_irc>
<@dirbaio:matrix.org> sequential-storage is much lighter but does linear scans to find keys. i'd recommend using sequential-storage if your store is small (<1000 keys) and ekv if it's big (>1000 keys)
<re_irc>
<@robgal519:matrix.org> Thank You, I will check them :D
<re_irc>
<@diondokter:matrix.org> : I want to make an async version too, but I implemented it with (limited) recursion. So I can't easily translate...
<re_irc>
<@dirbaio:matrix.org> oops
<re_irc>
<@dirbaio:matrix.org> :D
dc740 has quit [Remote host closed the connection]
<re_irc>
<@dirbaio:matrix.org> : you might want to add a checksum or something. If power fails while writing the config you might end up with "node_id != 0xFF" but unwritten 0xFF in other fields
<re_irc>
<@dirbaio:matrix.org> or completely random garbage if power fails while erasing
<re_irc>
<@dirbaio:matrix.org> so you can treat "checksum fail" as "no config"
<re_irc>
<@dirbaio:matrix.org> and this can still behave weird because if a change from "config A" to "config B" fails you can end up with "no config"
<re_irc>
<@dirbaio:matrix.org> so if you want to 100% guarantee config writes are atomic
<re_irc>
<@dirbaio:matrix.org> you need two copies of the config in separate pages, a "sequence number" to know which one is newer, and ping-pong between them
<re_irc>
<@dirbaio:matrix.org> using raw flash is trickier than it seems 🥲
<re_irc>
<@firefrommoonlight:matrix.org> Concur re checksum or other sanity check
<re_irc>
<@dirbaio:matrix.org> a crate that does just that would be useful
<re_irc>
<@dirbaio:matrix.org> no fancy key-value things
<re_irc>
<@firefrommoonlight:matrix.org> The dual copies also would add robustness
<re_irc>
<@dirbaio:matrix.org> just "read bytes", "atomically write bytes"
<re_irc>
<@firefrommoonlight:matrix.org> But I can also imagine nothing going wrong for thousands of cycles. Depends on if it's a safety-critical device etc
<re_irc>
<@firefrommoonlight:matrix.org> But your approach is better code complexity not withstanding
<re_irc>
<@dirbaio:matrix.org> yea... I guess, as always, the answer is It Depends™️
<re_irc>
<@dirbaio:matrix.org> ++D
<re_irc>
<@dirbaio:matrix.org> * =D
<re_irc>
<@dirbaio:matrix.org> for some applications it might be fine to erase the config if a write gets interrupted... 🤷