This project released by Rayen SELMI and Achref TELLILI demonstrates the use of Rust to program an ATmega328P microcontroller for analog data acquisition and UART communication. It includes both simulation in Proteus and hardware implementation on the Arduino Uno.
- Analog data acquisition from a potentiometer using ADC.
- Data conversion and serial communication via UART.
- Interrupt management with Timer1_OVF and semaphores.
- Deployment and testing on Proteus simulation and hardware using Hercules Virtual Terminal.
-
Install prerequisites as described in the [
avr-hal
README] (avr-gcc
,avr-libc
,avrdude
, [ravedude
]). -
Clone this repository:
git clone https://github.com/achreftel1/embedded_rust.git
cd embedded_rust
- Build the firmware:
cargo build
- Run the bash script to convert the ELF file to a HEX file, which will be used for the ATmega328P simulation in Proteus.
cd embedded_rust/target/avr-atmega328p/release
./elf2hex.sh
-
Open the simulation of proteus [Rust.pdsprj].
-
Hardware implementation using the Arduino Uno and flashing the firmware:
cd embedded_rust/target/avr-atmega328p/debug
wc -c first.elf
avrdude -p m328p -c arduino -P /dev/ttyACM0 -b 115200 -U flash:w:first.elf
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributions are welcome and will be dual-licensed under the above terms unless explicitly stated otherwise.