Skip to content

jakub-m/stm32f401-robo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM32F411RE RC rover

A toy rover with a remote controller, with software written in Rust.

img

Materials and docs

Rust

STM32, Nucleo

Arduino peripherals

Pins:

pins stm32f401re

Pinout table

  • Motor - Motor shield (additional), connects only to Arduino pins (CN6, CN7, CN5, CN9). "used" means that the pin is legitimately used by the motor shield.
  • Free? - Says if the pin is free for usage or is used by some functionality, or shield.

Left side

Morpho Free? CN7 CN7 CN6,8 Morpho Free? Arduino Motor
PC10 Y 1 2 PC11 Y
PC12 Y 3 4 PD2 Y
VDD 5 6 E5V
BOOT0 7 8 GND
NC 9 10 1 NC NC
NC 11 12 2 IOREF IOREF
PA13 Y 13 14 3 RESET RESET used
PA14 Y 15 16 4 +3V3 +3V3 used
PA15 Y 17 18 5 +5V +5V used
GND 19 20 6 GND GND used
PB7 Y 21 22 7 GND GND used
PC13 Y 23 24 8 VIN VIN used
PC14 Y 25 26 NC
PC15 Y 27 28 1 PA0 Y A0
PH0 Y 29 30 2 PA1 Y A1
PH1 Y 31 32 3 PA4 Y A2
VLCD Y 33 34 4 PB0 Y A3
PC2 Y 35 36 5 PC1 Y A4
PC3 Y 37 38 6 PC0 Y A5

Right side

Motor Arduino Morpho Free? CN5,9 CN10 CN10 Morpho Free?
PC9 Y 1 2 PC8 Y
D15 PB8 Y 10 3 4 PC6 Y
D14 PB9 Y 9 5 6 PC5 Y
AVDD AVDD 8 7 8 U5V
used GND GND 7 9 10 NC
D13 PA5 Y 6 11 12 PA12 Y
DIR_LATCH D12 PA6 5 13 14 PA11 Y
PWM2A D11 PA7 4 15 16 PB12 Y
PWM1B D10 PB6 3 17 18 PB11 Y
PWM1A D9 PC7 2 19 20 GND
DIR_SER D8 PA9 1 21 22 PB2 Y
DIR_EN D7 PA8 8 23 24 PB1 Y
PWM0A D6 PB10 7 25 26 PB15 Y
PWM0B D5 PB4 6 27 28 PB14 Y
DIR_CLK D4 PB5 5 29 30 PB13 Y
PWM2B D3 PB3 4 31 32 AGND
(?) D2 PA10 Y 3 33 34 PC4 Y
D1 PA2 Y 2 35 36 NC
D0 PA3 Y 1 37 38 NC

PWM1A and PWM2B are for servo.

Shift register to L293D mapping

  • Output - Output symbol on motor shield schema.
  • M - Motor(?) connection symbol on motor shield schema.
  • Bit - bit in shift register.
  • IC1, IC2 - inputs to each of L293D chips.
  • M1, M2 - output connectors, 1Y/5 means chip output 1Y and connector screw 5
  • PWM says which PWM output (from the table above) enables L293D outputs.
Output Bit M IC1 M1 PWM IC2 M2 PWM
QA 0 M3A 1A 1Y / 1 PWM0B
QB 1 M2A 4A 4Y / 2 PWM2B
QC 2 M1A 1A 1Y / 5 PWM2A
QD 3 M1B 2A 2Y / 4 PWM2A
QE 4 M2B 3A 3Y / 1 PWM2B
QF 5 M4A 4A 4Y / 4 PWM0A
QG 6 M3B 2A 2Y / 2 PWM0B
QH 7 M4B 3A 3Y / 5 PWM0A

Other resource usage

Should match what's in code.

Resource Function
TIM1 Clock
TIM3 PWM for M1

Details from probe-rs:

ARM Chip with debug port Default:
Debug Port: DPv1, DP Designer: ARM Ltd
└── 0 MemoryAP
    └── ROM Table (Class 1), Designer: STMicroelectronics
        ├── Cortex-M4 SCS   (Generic IP component)
        │   └── CPUID
        │       ├── IMPLEMENTER: ARM Ltd
        │       ├── VARIANT: 0
        │       ├── PARTNO: Cortex-M4
        │       └── REVISION: 1
        ├── Cortex-M3 DWT   (Generic IP component)
        ├── Cortex-M3 FBP   (Generic IP component)
        ├── Cortex-M3 ITM   (Generic IP component)
        ├── Cortex-M4 TPIU  (Coresight Component)
        └── Cortex-M4 ETM   (Coresight Component)

Lessons learned

  • derive_builder macro does not support no_std without nightly tool chain.

  • A monstrous generic struct is easy to use because of all the type inference in Rust.

  • RTIC Local and Shared state is not generic, which makes it prohibitively cumbersome to use when we want to initialize non-trivial state in init task and pass that state to idle task. A "non-trivial state" can be, for example, a DC motor controller that depends on several Pins.

  • HAL models allowed combinations of pins and peripherals with types. It is therefore not possible to use a pin with peripheral that the pin is not intended to (e.g. bad combination of GPIO, Timer and PWM Channel), the code will not compile. This is fantastic.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors