profile
viewpoint
Jan Teske ra-kete Bochum, Germany

ra-kete/dma-poc 13

Experiments with safe DMA abstractions in Rust

citruz/dmgwiz 4

Extract filesystem data from DMG files

ra-kete/stm32f3-gpio 1

Proof of Concept for a GPIO PAC for the STM32F3 family of MCUs

ra-kete/adc-rs 0

Rust implementation of the Apple Data Compression scheme

ra-kete/ark 0

A Rust Kernel

ra-kete/awesome-embedded-rust 0

Curated list of resources for Embedded and Low-level development in the Rust programming language

ra-kete/bare-metal 0

Abstractions common to microcontrollers

ra-kete/blog 0

The Rust Embedded WG Blog

ra-kete/brainrust 0

A brainfuck interpreter written in Rust.

ra-kete/cargo-binutils 0

Cargo subcommands to invoke the LLVM tools shipped with the Rust toolchain

startedutmapp/UTM

started time in 21 hours

fork marcquark/plugins

OPNsense plugin collection

https://opnsense.org/

fork in a day

fork marcquark/docs

OPNsense documentation

fork in a day

issue openedcitruz/dmgwiz

[Feature Request] #![no_std] support?

Would it be possible for this crate to support #![no_std], possibly with alloc? Maybe with an std feature.

created time in 2 days

startedargoproj/argo-cd

started time in 5 days

startedfluxcd/flux

started time in 5 days

startedm3tti/simple-money

started time in 7 days

startedmicrosoft/azure-devops-python-samples

started time in 7 days

startedcitruz/fakeartist

started time in 8 days

startedmicrosoft/terraform-provider-azuredevops

started time in 10 days

created repositoryNJannasch/HelloWorld-Azure-Pipeline

C++ Hello World example which is build by the Azure DevOps Pipeline

created time in 10 days

push eventstm32-rs/stm32f3xx-hal

Piroro-hs

commit sha 5c21f914eec842bc216b00545075f785c7191d7f

Fix for #154 I've just found my silly copy-paste mistake in #154 😢

view details

Fabian

commit sha 1359ca015921eec608e3a76eb190b75b82fb817f

Merge pull request #167 from Piroro-hs/patch-1 Fix for #154

view details

push time in 10 days

PR merged stm32-rs/stm32f3xx-hal

Fix for #154

I've just found my silly copy-paste mistake in #154 😢

+1 -1

0 comment

1 changed file

Piroro-hs

pr closed time in 10 days

PR opened stm32-rs/stm32f3xx-hal

Fix for #154

I've just found my silly copy-paste mistake in #154 😢

+1 -1

0 comment

1 changed file

pr created time in 10 days

created repositoryNJannasch/ant-heartrate-monitor

ANT+ based heartrate monitoring for training at home

created time in 10 days

startedPostgREST/postgrest

started time in 11 days

PublicEvent

issue openedrust-embedded/embedded-dma

intended api for serial dma read and write

I have been working on some examples using different setup() functions for different stm32*xx_hals and then common application code. Some time ago I put aside the serial dma examples because the different hal approaches were too different. Now these examples are some of the few I have not got working (scoreboard at https://pdgilbert.github.io/eg_stm_hal/), and I think there has been some progress adopting embedded-dma as a common approach.

Unfortunately, there do not seem to be examples in any of the hals that I am able to recognize as representing the new approach. Below is code that works with stm32f3xx_hal and the setup() part works with stm32f1xx_hal. stm32f3xx_hal provides buffer using methods read_exact() and write_all() which are used in the code below. Those methods are not provided by other hals and seem rather messy because the application code has to deal explicitly with the buffers rather than hiding them inside TxDma and RxDma objects. I think I should be using something like ReadDma and WriteDma but I am not sure.

  • Is there a method that is or might become available in all stm32*xx_hals?

  • Which hals have implemented current best practice?

  • Is there a good example of buffered read and write using current best practice?

I think my setup functions should be able to return buffered version of Tx and Rx. Previously I had it working that way with stm32f1xx_hal using something like tx1.with_dma(channels.4) and rx1.with_dma(channels.5) but I thought the hal was not using embedded-dma at the time and the .with_dma() method was not available in other hals.

  • What is the object I should be looking to return and what is the method to set it up?

  • Can my setup functions use some impl trait to find the return value type for these objects, and what traits should I be using?

Thanks for any insight. (I'm still a newbie so details are useful.)

#![deny(unsafe_code)]
#![no_main]
#![no_std]

#[cfg(debug_assertions)]
extern crate panic_semihosting;

#[cfg(not(debug_assertions))]
extern crate panic_halt;

use cortex_m::singleton;
use cortex_m_rt::entry;

use cortex_m_semihosting::hprintln;


#[cfg(feature = "stm32f1xx")]  //  eg blue pill stm32f103
use stm32f1xx_hal::{prelude::*,   
                    pac::Peripherals, 
                    serial::{Config, Serial, StopBits, Tx, Rx},
		    dma::{dma1, }, 
		    device::USART1 }; 
    
    #[cfg(feature = "stm32f1xx")]
    fn setup() ->  (Tx<USART1>, dma1::C4, Rx<USART1>, dma1::C5)  {
    
    // should be able to do something like
    //fn setup() ->  (impl WriteDma<USART1>, impl ReadDma<USART1> )  {
    
       let p = Peripherals::take().unwrap();
       let mut rcc = p.RCC.constrain();  
       let clocks = rcc.cfgr.freeze(&mut p.FLASH.constrain().acr); 
       let mut afio = p.AFIO.constrain(&mut rcc.apb2);
       let mut gpioa = p.GPIOA.split(&mut rcc.apb2);

       let txrx1 = Serial::usart1(
	   p.USART1,
	   (gpioa.pa9.into_alternate_push_pull(&mut gpioa.crh),     //tx pa9, 
            gpioa.pa10),					    //rx pa10
	   &mut afio.mapr,
	   Config::default() .baudrate(9600.bps()) .stopbits(StopBits::STOP1),
	   clocks,
	   &mut rcc.apb2,
	   );  //.split();

       let (tx1, rx1)  = txrx1.split();

       let dma1 = p.DMA1.split(&mut rcc.ahb);
       let (tx1_ch, rx1_ch) = (dma1.4, dma1.5);
 
       // should be able to return just (tx1, rx1)
       
       (tx1, tx1_ch,   rx1, rx1_ch)
       }


#[cfg(feature = "stm32f3xx")]  //  eg Discovery-stm32f303
use stm32f3xx_hal::{prelude::*, 
                    stm32::Peripherals,
		    serial::{Serial, Tx, Rx}, 
		    dma::dma1, 
		    stm32::USART1 
		    };

    #[cfg(feature = "stm32f3xx")]
    fn setup() ->  (Tx<USART1>, dma1::C4, Rx<USART1>, dma1::C5)  {

    // should be able to do something like
    //fn setup() ->  (impl WriteDma<USART1>, impl ReadDma<USART1> )  {

       let p = Peripherals::take().unwrap();
       let mut rcc = p.RCC.constrain();  
       let clocks    = rcc.cfgr.freeze(&mut p.FLASH.constrain().acr);
       let mut gpioa = p.GPIOA.split(&mut rcc.ahb); 

       let txrx1 = Serial::usart1(
    	   p.USART1,
    	   (gpioa.pa9.into_af7( &mut gpioa.moder, &mut gpioa.afrh), 
 	    gpioa.pa10.into_af7(&mut gpioa.moder, &mut gpioa.afrh)),
    	   9600.bps(),
    	   clocks,
    	   &mut rcc.apb2,
           );

       let (tx1, rx1)  = txrx1.split();

       let dma1 = p.DMA1.split(&mut rcc.ahb);
       let (tx1_ch, rx1_ch) = (dma1.ch4, dma1.ch5);

       // should be able to return just (tx1, rx1)
       
       (tx1, tx1_ch,   rx1, rx1_ch)
       }


    // End of hal/MCU specific setup. Following should be generic code.



#[entry]
fn main() -> ! {
     
    let (tx1, tx1_ch,   rx1, rx1_ch) = setup();

    hprintln!("test write to console ...").unwrap();

    let buf = singleton!(: [u8; 15] = *b"\r\ncheck console").unwrap();
    
    *buf = *b"\r\nSlowly type  ";  //NB. 15 characters


    // create recv and send structures that can be modified in loop rather than re-assigned.
    
    let mut recv = rx1.read_exact(buf, rx1_ch).wait();    //this returns 3-tuple (buf, rx1_ch, rx1)

    let mut send = tx1.write_all(recv.0, tx1_ch).wait();  //this returns 3-tuple (buf, tx1_ch, tx1)

    // Note send (write) is using buf as put into recv (read). The returned buffer in recv and
    //   the argument buffer in send are data. The argument buffer in recv may be a holding spot 
    //   to put return buffer? but it is not part of the program logic. The size of the return
    //   buffer from recv does seem to be determined by the size of the recv argument buffer.
    //   The return buffer from send seems like it should be unnecessary, but it does provide
    //   the buffer needed in the recv argument.
    
    // Read from console into  buf and echo back to console
    
    hprintln!("Enter 15 characters in console. Repeat.").unwrap();
    hprintln!("Use ^C in gdb to exit.").unwrap();

    //each pass in loop waits for input of 15 chars typed in console then echos them
    loop { 
       recv = recv.2.read_exact(send.0, recv.1).wait();   
       send = send.2.write_all( recv.0, send.1).wait(); 
       }
}

created time in 14 days

fork citruz/sdk-api

Public contributions for win32 API documentation

fork in 14 days

fork citruz/win32

Public mirror for win32-pr

fork in 14 days

starteddeepmind/lab

started time in 15 days

starteddeepmind/lab2d

started time in 15 days

startedopen-wc/open-wc

started time in 18 days

startedfrankie567/fastapi-users

started time in 21 days

push eventcitruz/dmgwiz

citruz

commit sha 4d1178d9e001f5143caafc92eed18c1b4f7eaaa4

Added download link to readme

view details

push time in 22 days

created tagcitruz/dmgwiz

tagv0.2.3

Extract filesystem data from DMG files

created time in 22 days

release citruz/dmgwiz

v0.2.3

released time in 22 days

push eventcitruz/dmgwiz

Felix Seele

commit sha 3a42a839f761e8988b6c65525ebf0f933e9f05d0

added cargo audit CI workflow

view details

push time in 22 days

delete branch citruz/dmgwiz

delete branch : fix-data-offset

delete time in 22 days

push eventcitruz/dmgwiz

Felix Seele

commit sha f13f72186d16a00c6ac95c11d5ec330eb53fb242

added handling for non-null value of blkx_table.data_offset

view details

Felix Seele

commit sha 250b400c9e32d929e97f402493a6890cde2055a6

fixed and improved tests

view details

Felix Seele

commit sha f3388842ac90e4b16ae03656c2e40ede45e27c23

fixed formatting

view details

Felix Seele

commit sha 84092d08fd5e7186c08e04ab704229882e5460c4

version bump

view details

citruz

commit sha ed8fa6b876ec09d6e646dcba784c3325938f4aec

Merge pull request #13 from citruz/fix-data-offset added handling for non-null value of blkx_table.data_offset

view details

push time in 22 days

more