MCU: различия между версиями

Материал из fidoman.ru
Строка 43: Строка 43:
  
 
SBK bit: send '''break''' character (do not set again before prv '''break''' is sent)
 
SBK bit: send '''break''' character (do not set again before prv '''break''' is sent)
 +
 +
UART_CR1.R8: MSB for received 9-bit words
  
 
=== jobs ===
 
=== jobs ===

Версия 17:04, 4 ноября 2021

cam

ESP32-CAM OV2460

links

Lightweight C compilers http://fun4diy.com/

STM8

compilers comparation http://www.colecovision.eu/stm8/compilers.shtml

startup

  1. Power requirements: 3.3-5V
  2. Reset circuit (100nF cap)
  3. Select clock source (ext.crystal/HSI)
  4. Choose halt modes for
    1. flash
    2. HSI, HSE
  5. use timer or AWU for wake-up if no ext.ints
  6. calibrate LSI osc.
  7. configure GPIO
  8. use watchdog

AWU

  • on int disable AWU (or new int will be generated instantly)
  • before re-enable re-load counter

UART

- word length: UART_CR1.M
- stop bits: UART_CR3
- baud rate: UART_BRR2 then UART_BRR1
- en transmitter: UART_CR2.TEN
- send data: UART_DR and wait until TC goes 1

TXE: set at end of transmission (and if TIEN then int is generated) - can send more

 wait for TXE before write DR

TC: transmission complete (and if TCIEN then int is generated) - may disable transmitter

SBK bit: send break character (do not set again before prv break is sent)

UART_CR1.R8: MSB for received 9-bit words

jobs

MAYHALT - semaphore, must be incremented on start of each no-halt process e.g. UART TX syssleep func:

 check for mayhalt
 if zero halt
 if not wfi
 loop if no jobs else get toppest by pri and start

sysjobs:

 populated with int handlers, address of jobs to run (with associated data ptr)

?sysqueues: ? if smth is put on it, associated job is created by system