!BHcierreUuwCMxVqOf:matrix.org

Rust Embedded

359 Members
Welcome to the Rust Embedded chat room! | Bridged to Freenode IRC: #rust-embedded | Public logs: https://freenode.logbot.info/rust-embedded/ | Discuss, coordinate, help: https://github.com/rust-embedded/wg | Code of conduct: https://www.rust-lang.org/conduct.html37 Servers

Load older messages


SenderMessageTime
15 May 2021
@firefrommoonlight:matrix.orgfirefrommoonlight

Here's the code I'm testing with so far:

    let mut dma = Dma::new(dp.DMA1, &mut dp.RCC);
    spi.enable_dma(&mut dma);

    let mut xmit_buf = [0x00_u8]; // Buffer to request a read of the config data.
    let mut read_buf = [0_u8; 1];  // Buffer to place the resulting read in.

    loop {
        cs_rtd.set_low();
        spi.write_dma(xmit_buf, &mut dma);
        cs_rtd.set_high();

        delay.delay_ms(100);

        cs_rtd.set_low();
        spi.read_dma(read_buf, &mut dma);
        cs_rtd.set_high();

        delay.delay_ms(1_000);
    }
02:45:18
@firefrommoonlight:matrix.orgfirefrommoonlightPresumably with interrupt-based flow, you'd instead use an interrupt, but should code like that work?02:45:56
@dirbaio:matrix.orgDirbaio
In reply to @grantm11235:matrix.org
Would it be possible to impl the e-h blocking traits in embassy in such a way that other tasks could continue while one is blocking?

no :(

not with async/await at least. With a full RTOS (with actual threads with a stack each) it'd be definitely possible

02:46:08
@firefrommoonlight:matrix.orgfirefrommoonlight

Oops: Correction to above:

    let mut xmit_buf = DmaWriteBuf { buf: [0x00_u8] }; // Buffer to request a read of the config data.
    let mut read_buf = DmaReadBuf { buf: [0_u8; 1] };  // Buffer to place the resulting read in.
02:46:52
@firefrommoonlight:matrix.orgfirefrommoonlight Where those structs impl the embedded_dma traits 02:47:07
@dirbaio:matrix.orgDirbaiowrite_dma/read_dma are blocking I guess?02:47:47
@dirbaio:matrix.orgDirbaiowith interrupts you'd call a "start_write_dma" that returns immediately02:48:02
@dirbaio:matrix.orgDirbaiothen the interrupt would fire later, youd start the read from there02:48:14
@dirbaio:matrix.orgDirbaioetc02:48:15
@firefrommoonlight:matrix.orgfirefrommoonlightYea - this is the simplest code to start with02:48:16
@firefrommoonlight:matrix.orgfirefrommoonlightThe dleays here are a shim to "block"02:48:31
@firefrommoonlight:matrix.orgfirefrommoonlight Ie, write_dma there should return immediately 02:48:57
@dirbaio:matrix.orgDirbaioaah02:49:20
@dirbaio:matrix.orgDirbaiowell yeah, instead of hardcoding a delay there you'd do the "next thing" in the interrupt callback02:49:40
@dirbaio:matrix.orgDirbaioblocking or async reads "from top to bottom", it becomes callback spaghetti if you turn it interrupt driven :D02:49:51
@firefrommoonlight:matrix.orgfirefrommoonlightIf this works out, I'll make the examples mostly using DMA02:56:04
@firefrommoonlight:matrix.orgfirefrommoonlightProbably with a mix of approaches (interrupts, blocking etc)02:56:15
@firefrommoonlight:matrix.orgfirefrommoonlightRedacted or Malformed Event02:56:41
@firefrommoonlight:matrix.orgfirefrommoonlight * I mainly want this library and examples to be a "How to do production rust embedded"02:57:48
@firefrommoonlight:matrix.orgfirefrommoonlight * If this works out, I'll make the examples mostly using DMA02:58:03
@9names:matrix.org9names
In reply to @spencerdento:matrix.org
hi all! I'm new to the embedded rust world--but have about a year of experience from school, I'm really comfortable with the tm4c123 launchpad. Does anyone know of any issues with systick in the tm4c123x hal? My led seems to be staying on/off for double the amount of time specified...I apologize in advance for a trivial solution lol. ignore the & on the embedded_hal::digital lines, i quickfixed it and forgot to remove those
I just wrote a quick test on my Tiva C launchpad, and am getting the expected timing. I set it to 500ms on and 500ms off, and observe a 1s blink interval.
Gist is here:
https://gist.github.com/9names/ab435db6bdf9056cd285c2710825ae5f
03:44:28
@spencerdento:matrix.orgspencerdento 9names: thank you! 03:51:49
@freenode_seds:matrix.orgseds left the room.06:44:41
@freenode_seds:matrix.orgseds joined the room.06:46:14
@chand28298:matrix.orgchand28298 joined the room.07:43:34
@freenode_tokomak:matrix.orgtokomak joined the room.08:33:38
@xoviat:matrix.org@xoviat:matrix.org left the room.09:00:16
@leonardohn:matrix.org@leonardohn:matrix.org left the room.09:00:18
@tnrupxnowyhmde:matrix.org@tnrupxnowyhmde:matrix.org left the room.09:00:19
@sparky:matrix.possumlodge.me@sparky:matrix.possumlodge.me left the room.09:00:31

There are no newer messages yet.


Back to Room List