Skip to content

hacksintaiwan/hitcon-pcb-badge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HITCON PCB Badge

Firmware Development

execute fw/merge.py to merge STM32CubeIDE generated main.c with user code in main.cc into main.cc.

Timers and DMA Channels

  • IR Tx: PWM Output from TIM3_CH3, Output PB0, DMA1 Ch2
    • Compare: 63/4 = 16
    • Mode: Circular Normal Peripheral to Memory
Peripheral Memory
Increment Address X V
Data Width Half Word Half Word
  • IR Rx: DMA Triggered through TIM2_CH3, Input PA0 read by DMA1 Ch1
    • Compare: 105
    • Mode: Circular Peripheral to Memory
Peripheral Memory
Increment Address X V
Data Width Half Word Half Word
  • Led Rows/Cols: DMA Triggered through TIM1_UP, Output PB6-9(Rows), Output PB1-2/10-15(Cols), written by DMA1 Ch5
    • Mode: Circular Memory to Peripheral
Peripheral Memory
Increment Address X V
Data Width Word Word
  • Led Brightness control: PWM Output from TIM3_CH2
  • Buttons: Reads Input PA4-10, PA15 through TIM4_CH2, DMA1 Ch4
    • Compare: 5
    • Mode: Circular Peripheral to Memory
Peripheral Memory
Increment Address X V
Data Width Half Word Half Word
  • Cross-board communication TX: USART2 TX, DMA1 Ch7

  • Cross-board communication RX: USART2 RX, DMA1 Ch6

  • TIM4: Operates at 100Hz for Button

    • Prescaler: 12000-1
    • Counter Period: 10-1
  • TIM3: Operates at 38kHz for PWM out.

    • Prescaler: 5-1
    • Counter Period: 63-1
    • Master Mode Enable
  • TIM2:

    • Prescaler: 0
    • Counter Period: 4-1
    • Slave Mode: External Clock
    • Trigger Source: ITR2 (TIM3 Update Event)
    • Operates at 1/4 speed of TIM3, synchronization needed for IR pulse alignment and brightness adjustment.
    • Also operates at 1/4 bit time for capturing IR.
    • TIM2 = 38/4 kHz = 9.5kHz.
    • Bit time = 4/9.5kHz = 421us (each bit is 16 pulse).
  • TIM1:

    • Prescaler: 5-1
    • Counter Period: 1500-1
    • LED refreshes at 3200/16 = 200Hz.

Format

To check format, please install clang-format first.

# under hitcon-pcb-badge
./lint.sh # check format
./lint.sh -i # auto format

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 91.5%
  • C++ 6.9%
  • Python 1.2%
  • Rust 0.2%
  • Assembly 0.2%
  • Makefile 0.0%