<re_irc>
<ignormies> hey guys, I'm still having some issues with timing for SPI writes, even using the faster "blocking::spi::Write".
<re_irc>
Here are two screenshots of my signal, one built with "--release" and one without. The one with "--release" is obviously better, but still broken.
<re_irc>
<ignormies> hey guys, I'm still having some issues with timing for SPI writes, even using the faster "blocking::spi::Write".
<re_irc>
Here are two screenshots of my signal, one built with "--release" and one without. The one with "--release" is obviously better, but still broken.
<re_irc>
Does anyone know where to begin diagnosing? I am using an "stm32f103" bluepill
<re_irc>
<GrantM11235> Is that the clock signal or the data signal?
<re_irc>
<ignormies> That is the data signal, but I am sending "&[0b10101010, 0b10101010]" as a way of diagnosing timing
<re_irc>
<ignormies> * timing, so it looks kinda like a clock signal
<re_irc>
<ignormies> hey guys, I'm still having some issues with timing for SPI writes, even using the faster "blocking::spi::Write".
<re_irc>
Here are two screenshots of my signal, one built with "--release" and one without. The one with "--release" is obviously better, but still broken, with a huge gap between words.
<re_irc>
<GrantM11235> The stm32f1 spi doesn't have a FIFO buffer, so the HAL has to wait for the first byte to finish before it can configure the next byte to be sent
<re_irc>
<ignormies> oh interesting. I guess that makes sense. Maybe I should use the stm32f401 blackpill I have lying around instead -- does that have a buffer?
<re_irc>
Why does "--release" chop out so many instructions here tho?
<re_irc>
<GrantM11235> Are you running the cpu at the full 72mhz?
<re_irc>
<GrantM11235> The reason that "--release" helps is that it enables optimizations which allows the cpu to send the next byte faster once it sees that the last byte was sent
<re_irc>
<GrantM11235> I'm a bit surprised that the cpu can't react in time though
<re_irc>
<GrantM11235> I mis-remembered the datasheet. The stm32f1 _does_ have a single word buffer
<re_irc>
<GrantM11235> So there should be plenty of time to keep the spi fed without any gaps
<re_irc>
<ignormies> yeah, according to the reference manual, the TXE flag is set at the _start_ of the transmission for the previous word, not the end
<re_irc>
<ignormies> Thanks so much for the help GrantM11235 ! After some tinkering it looks like using "opt-level" >=2 _and_ "lto = 'fat'" is necessary for me to drive the SPI at the speed I need on this chip
<re_irc>
<GrantM11235> I'm surprised that "lto = 'fat'" makes such a difference. Maybe someone needs to add some "#[inline]" tags somewhere
<re_irc>
<GrantM11235> But for embedded there is really no reason not to use "lto = 'fat'" all the time
<re_irc>
<GrantM11235> Hmm, I'm not seeing any difference at all between fat and thin lto
<re_irc>
<ignormies> GrantM11235: actually, are you sure "thin" is the default? Looks like "thin" works just as well as "fat" for me. this (https://doc.rust-lang.org/cargo/reference/profiles.html#release) has "lto" defaulting to "false" for the "release" profile
<re_irc>
<GrantM11235> With lto off, I am seeing non-inlined calls to stuff like "stm32f1::stm32f103::spi1::sr::TXE_R::new"
<re_irc>
<Trevor Gross> Hey all, is there any official work toward a HAL for xilinx parts (Zynq specifically), or any guidelines for work with FPGA/Cortex combo parts? https://git.m-labs.hk/m-labs/zynq-rs exists and actually has a lot of work, but I'm wondering why it's not under the embedded wg's umbrella
<re_irc>
<GrantM11235> I don't think there are any HALs that are officially part of the wg
<re_irc>
<Trevor Gross> I think I just realized that - the documentation for https://github.com/atsamd-rs/atsamd is so complete that it seems very official
<re_irc>
<Trevor Gross> Is there any reason HALs aren't under the workgroup, other than just adding more things to maintain?
<re_irc>
<GrantM11235> It looks like this will be fixed in the next version of stm32f1xx_hal
<re_irc>
<GrantM11235> Trevor Gross: The HALs aren't really developed by the working group, they are developed by individual devs who may or may not be in the wg
<re_irc>
<GrantM11235> HALs are naturally very opinionated, and it is better to avoid having an "official opinion" (in my unoffical opinion 😁)
explore has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
m5zs7k has quit [Ping timeout: 264 seconds]
m5zs7k has joined #rust-embedded
<re_irc>
<alex (@alex:matrix.sempto.net)> 9names: Sorry, saw that a bit late. Basically I require something to read electric meters using serial, then read some water sensors and also do some pulse counting to read a water meter
<re_irc>
<alex (@alex:matrix.sempto.net)> So I have built a board with 8 RJ12 connectors and a pi pico
<re_irc>
<alex (@alex:matrix.sempto.net)> Oh and a RS485 interface to report the results back to the server
<re_irc>
<alex (@alex:matrix.sempto.net)> So basically I need to be able to switch those connectors either to UART mode, pulse counting mode or GPIO (high/low) detection.
<re_irc>
<alex (@alex:matrix.sempto.net)> Not sure if I'll manage to do it in rust though. It feels like I'm trying to fly without learning to walk first.
explore has quit [Quit: Connection closed for inactivity]
<re_irc>
<9names (@9names:matrix.org)> that certainly is a lot for just getting started! nice practical problem though, and each of the parts shouldn't be insurmountable, I think it's not a bad first project.
<re_irc>
<alex (@alex:matrix.sempto.net)> 9names: Well, not the first rust microcontroller project, just the first one on the pico.
<re_irc>
The first one was a lot more imperative and C like.
<re_irc>
<alex (@alex:matrix.sempto.net)> So I guess I either need to learn how to use the type system or switch back to the simpler less elegant style
<re_irc>
<alex (@alex:matrix.sempto.net)> hardcode more stuff, like connector 1 is always UART, etc
<re_irc>
<jannic> In the past, the lines read "KEEP(*(.trap))", the "KEEP" was removed but the parentheses stayed. With a recent nightly update lld became more picky and now rejects the lines.
causal has quit [Quit: WeeChat 3.6]
neceve has quit [Changing host]
neceve has joined #rust-embedded
<re_irc>
<almindor> jannic: Nice fix, thanks! could you just please add a CHANGELOG entry as well?