Questions tagged [rust-embedded]

10 questions
2
votes
2 answers

Get elapsed time since some instant in embedded rust

I started making a program in rust, and I want to be able to get the elapsed time since some instant. Here's how the std library does it. use std::time::{Duration, Instant}; use std::thread::sleep; fn main() { let now = Instant::now(); // we…
Hardware
  • 33
  • 5
2
votes
1 answer

Enforcing trait implemented only on given type size in Rust

For embedded/IO use case in Rust, I need to build a lib to receive/transmit messages using a small fixed size buffer (must not exceed it). The messages themselves will be defined by the user of the lib. Is there a way to define a Rust trait or a…
Yuri Astrakhan
  • 8,808
  • 6
  • 63
  • 97
1
vote
0 answers

Rust no_std ESP32 hal | ADC & DMA at 192 kHz sample rate

I’m trying to implement ADC conversion in a non blocking mode using DMA from gpio analog input at the sample rates: 192kHz. My questions: How to be implemented ADC in non-blocking mode (DMA). Something like: // DMA let dma =…
0
votes
0 answers

Programming UART driver for bare-metal msp430 using rust

I'm trying to implement an UART driver for the msp430fr5969, using rust but I'm struggling to get it to work. To do so, I ported a driver that I wrote in C a long time ago to rust, using the msp430-quickstart project as a template, and a peripheral…
Hugo REYMOND
  • 329
  • 1
  • 11
0
votes
1 answer

Equivalent of "tone()" in avr_hal

I'm trying to translate the following code from the Arduino IDE Into Rust using the avr_hal crate to make a passive buzzer play notes: #include "pitches.h" // notes in the melody: int melody[] = { NOTE_C5, NOTE_D5, NOTE_E5, NOTE_F5, NOTE_G5,…
JasterV
  • 17
  • 5
0
votes
1 answer

Set alternate mode for stm32 rust HAL

I want to set alternate mode for AP10 of stm32f411 by rust HAl. My code looks like this: let rx_pin = gpioa.pa10.into_alternate(); But it has multiple impl: = note: multiple `impl`s satisfying `stm32f4xx_hal::gpio::Pin<'A', 10>:…
tuanti1997qn
  • 57
  • 1
  • 10
0
votes
0 answers

Embedded Rust & Embassy | Analog measurement - ADC & DMA | STM32F7

My setup: The signal is connected to the analog input of the STM32F767. ADC sampling rate should be at least 192kHz because input signal frequency is between 1Hz and 40kHz. Also STM32 connected to the client via ETH port (UDP protocol). My…
0
votes
0 answers

rp2040_hal I2CPeripheralEventIterator usage

Coming from C# and the .NET world, I needed to go bare metal with some IC (in this case the rp2040), and choose Rust based on every comment that I saw for the language. Until now, I been able to easily use gpio, I2C as master, but my usage case, the…
0
votes
0 answers

Rust stm32f7 | ADC & DMA at 192 kHz sample rate

I’m trying to implement ADC conversion from gpio analog input at the sample rate of 192 kHz. Then I want to send the array of samples over tcp to the client. My question: How to implement ADC convertion using DMA for STM32F767ZI? There is such…
-1
votes
1 answer

Modifying a specific memory address in Rust

I declared pointers (memory addresses) and I am able to read values like that in Rust: let psram = 0x60000000 as *const u32; let psramh = 0x60000000 as *const u16; let psramb = 0x60000000 as *const u8; let psram0 = unsafe…
Adrien Chapelet
  • 386
  • 4
  • 24