fabic has joined #rust-embedded
starblue2 has joined #rust-embedded
starblue1 has quit [Ping timeout: 240 seconds]
fabic has quit [Ping timeout: 258 seconds]
fabic has joined #rust-embedded
<re_irc> <@w​00tspeaks:m​atrix.org> The arduino leonardo usb serial CDC device appears to not be supported directly in avr-hal. Is there anyother crate that can help me?
<re_irc> <@w​00tspeaks:m​atrix.org> FWIW, I couldn't find a driver implementation for atmega32u4 for usb-device either.
neceve has joined #rust-embedded
dcz has joined #rust-embedded
<re_irc> <@d​isasm-ewg:m​atrix.org> Wren T: usb-device needs `AtomicPtr` and atmega32u4 doesn't have any atomics iirc
<re_irc> <@j​amesmunns:m​atrix.org> disasm: Maybe we could use dirbaio 's atomic-polyfill?
<re_irc> <@j​amesmunns:m​atrix.org> Is there a global interrupt mask on the atmega arch?
<re_irc> <@j​amesmunns:m​atrix.org> And has someone made a critical section impl for it already?
<re_irc> <@9​names:m​atrix.org> is there a microcontroller that has interrupts and doesn't have interrupt disable/enable flags of some sort?
<re_irc> <@d​isasm-ewg:m​atrix.org> Something with NMI/HardFault probably
emerent_ has joined #rust-embedded
emerent_ is now known as emerent
emerent is now known as Guest7970
Guest7970 has quit [Ping timeout: 272 seconds]
<re_irc> <@9​names:m​atrix.org> in the case of an NMI or hardfault you should not be caring about atomic values anyway, so... i guess they're fine?
<re_irc> <@d​isasm-ewg:m​atrix.org> In case of USB probably yes, but in general Rust allows this
<re_irc> <@d​isasm-ewg:m​atrix.org> RP2040 will face the same problem maybe. But it also has two cores which makes the idea even more unsound
<re_irc> <@9​names:m​atrix.org> but it also has hardware spinlock registers, so we can implement the polyfill with one of those
<re_irc> <@9​names:m​atrix.org> they are not "fair" (core0 gets priority over core1) so starvation is definitely a concern, but it's better than dealing with data races
dcz has quit [Ping timeout: 256 seconds]
dcz has joined #rust-embedded
<re_irc> <@w​00tspeaks:m​atrix.org> The avr-hal implementation of usart also appears to not be generic enough to support the USB serial right now. I'm not sure what the approach to fix it might be.
<re_irc> <@w​00tspeaks:m​atrix.org> I did find this: https://github.com/Rahix/avr-hal/issues/40
<re_irc> <@w​00tspeaks:m​atrix.org> Also, it looks like the avr toolchain has been broken due to an llvm upstream change a while ago. That's a bummer.
<re_irc> <@w​00tspeaks:m​atrix.org> If I want to do can-fd on an embedded platform with rust, does anyone have recommendations?
<re_irc> <@d​irbaio:m​atrix.org> Why does usb-device require atomics and
<re_irc> <@d​irbaio:m​atrix.org> and Sync anyway?
<re_irc> <@w​00tspeaks:m​atrix.org> i am using canbed-fd, right now, but the rust support for the leonardo is not great.
<re_irc> <@d​irbaio:m​atrix.org> Couldn't it be made "single threaded"?
<re_irc> <@w​00tspeaks:m​atrix.org> Wouldn't you need synchronization when handling and interrupt or something?
<re_irc> <@d​irbaio:m​atrix.org> So that the user can chose to put it in a mutex if they want to use it from interrupts or whatever
<re_irc> <@d​irbaio:m​atrix.org> But the user is not forced to
<re_irc> <@d​irbaio:m​atrix.org> So it works for weird platforms without atomics too
<re_irc> <@w​00tspeaks:m​atrix.org> It does look like the avr has some notion of atomics. I guess they just aren't implemented in rust?
<re_irc> <@w​00tspeaks:m​atrix.org> I don't know enough to speak competently on this. I just want to add cans to my car. :)
<re_irc> <@9​names:m​atrix.org> no, it really doesn't. find an stm32 with the peripherals you need, they have much better rust support than avr
<re_irc> <@w​00tspeaks:m​atrix.org> bummer
<re_irc> <@w​00tspeaks:m​atrix.org> Holy hell that's expensive.
<re_irc> <@w​00tspeaks:m​atrix.org> Maybe I just need to stick with pseudo-c++ (arduino) for now.
<re_irc> <@9​names:m​atrix.org> which thing is expensive?
<re_irc> <@9​names:m​atrix.org> the simpler stm32s should not be much more expensive than an avr, assuming you can find any at the moment due to chipageddon
<re_irc> <@d​irbaio:m​atrix.org> chipocalypse
<re_irc> <@w​00tspeaks:m​atrix.org> I like chipocalypse
<re_irc> <@w​00tspeaks:m​atrix.org> https://copperhilltech.com/blog/stm32-ultralowpower-iot-development-kit-with-integrated-can-fd-interface/ <--this is what I saw first when I looked for stm32 and canfd
<re_irc> <@9​names:m​atrix.org> i thought chip impact was a better movie 🤣
<re_irc> <@9​names:m​atrix.org> you can still go with a cheap stm32 and use the spi can-fd chip that the AVR was using
<re_irc> <@w​00tspeaks:m​atrix.org> BTW. In case you're interested, this is what I am working on:
<re_irc> <@w​00tspeaks:m​atrix.org> I found cheaper options.
<re_irc> <@d​irbaio:m​atrix.org> lol dont't get a stm32f2, they're ultra uncommon and not that well supported
<re_irc> <@w​00tspeaks:m​atrix.org> I guess I'll avoid that one then
<re_irc> <@m​riise:m​atrix.org> i have stm32f2 and can confirm, not worth it
<re_irc> <@w​00tspeaks:m​atrix.org> Do you have any recommendations for things to consider?
<re_irc> <@m​riise:m​atrix.org> you are looking for can-fd correct?
<re_irc> <@w​00tspeaks:m​atrix.org> yes
<re_irc> <@m​riise:m​atrix.org> though its not quite ready on the software side of things
<re_irc> <@m​riise:m​atrix.org> currently the hal is usable for most things but im still struggling with some things
<re_irc> <@m​riise:m​atrix.org> its a new chip and NXP isnt exaclty the most helpful (from what ive heard)
<re_irc> <@m​riise:m​atrix.org> but it would fill the requirement of high perfomance, good power efficiency, and mostly batteries included interfaces
<re_irc> <@m​riise:m​atrix.org> usb with integrated PHY is nice
<re_irc> <@w​00tspeaks:m​atrix.org> is the canfd interface open enough to write with rust?
<re_irc> <@w​00tspeaks:m​atrix.org> That's one thing I like about the canbed-fd.
<re_irc> <@w​00tspeaks:m​atrix.org> Also, how do I find devices that I can buy and not just the chips.
<re_irc> <@w​00tspeaks:m​atrix.org> ?
<re_irc> <@m​riise:m​atrix.org> LPCXpresso line
<re_irc> <@m​riise:m​atrix.org> idk of any dev boards besides the one from NXP,
<re_irc> <@m​riise:m​atrix.org> the only other one i know of for lpc55 family is for lpc55s69
<re_irc> <@m​riise:m​atrix.org> if you are wanting fully developed devises for CAN then i do not know of any sadly
<re_irc> <@w​00tspeaks:m​atrix.org> Okay, so what would I need to program these?
<re_irc> <@w​00tspeaks:m​atrix.org> Do you need a separate programmer?
<re_irc> <@w​00tspeaks:m​atrix.org> Or can you program with something like avrdude?
<re_irc> <@m​riise:m​atrix.org> if you want to program these then you will have to use the JLink patch for the link2 integrated chip
<re_irc> <@m​riise:m​atrix.org> but that's just over the microusb port
<re_irc> <@w​00tspeaks:m​atrix.org> Does that mean I need some JLink piece of hardware or are you saying I just need a usb cable?
<re_irc> <@9​names:m​atrix.org> the lpcxpresso boards come with a second on-board microcontroller for programming. you need to reprogram it with jlink firmware
<re_irc> <@9​names:m​atrix.org> or cmsis-dap firmware, that is better supported by probe-rs
<re_irc> <@w​00tspeaks:m​atrix.org> So, I do need some kind of programmer?
<re_irc> <@9​names:m​atrix.org> from the page you just linked "he board features an onboard LPC-Link2 debug probe based on the LPC4322 MCU for a performance debug experience over high-speed USB, with easy firmware update options to support CMSIS-DSP or a special version of J-link LITE from SEGGER."
<re_irc> <@9​names:m​atrix.org> you can run lpcscrypt to change the firmware on the debugger that is integrated onto the board
<re_irc> <@w​00tspeaks:m​atrix.org> Can this be done from Linux?
<re_irc> <@9​names:m​atrix.org> yes
<re_irc> <@w​00tspeaks:m​atrix.org> Cool.
<re_irc> <@w​00tspeaks:m​atrix.org> Thanks for answering all these n00b questions.
<re_irc> <@9​names:m​atrix.org> thank you for asking and listening
neceve has quit [Remote host closed the connection]
fabic has quit [Ping timeout: 256 seconds]
<re_irc> <@w​00tspeaks:m​atrix.org> I bought a couple. I guess we'll see how this goes.
<re_irc> <@m​arcuss2:t​edomum.net> jamesmunns: Yes, you can just disable interrupts, run your code and re-enable them again on AVR
<re_irc> <@m​riise:m​atrix.org> @wr
dcz has quit [Ping timeout: 258 seconds]
fabic has joined #rust-embedded
<re_irc> <@j​atsekku:m​atrix.org> Hello guys!
<re_irc> <@j​atsekku:m​atrix.org> I would like to get involved into contributions for avr-hal.
<re_irc> <@j​atsekku:m​atrix.org> I'm looking for some help how to get started, maybe some kind of mentoring etc. I'm pretty new to the rust, and total newbie in open source contribution.
<re_irc> <@j​wagen:m​atrix.org> jatsekku: you can also check out #avr-rust_Lobby:gitter.im .
<re_irc> <@j​atsekku:m​atrix.org> Thank you
dcz has joined #rust-embedded
fabic has quit [Ping timeout: 240 seconds]
fabic has joined #rust-embedded
GenTooMan has quit [Ping timeout: 256 seconds]
GenTooMan has joined #rust-embedded
fabic has quit [Ping timeout: 272 seconds]
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 265 seconds]
<re_irc> <@j​ohn_socha:m​atrix.org> I'd like to get some feedback on a crate that I plan to publish to crates.io. This is a driver for a character LCD that uses I2C. I have it working for a version of the display with an RGB backlight, and plan to update it, if needed, to also work with a monochrome character LCD. Both of these displays are 16x2...
<re_irc> ... displays. I'm about three weeks into my Rust journey and would love to get feedback and suggestions of things I should change before I publish the crate. https://github.com/JohnSL/lcd_1602_i2c
<re_irc> <@w​00tspeaks:m​atrix.org> mriise: thanks
dcz has quit [Ping timeout: 258 seconds]