728x90
반응형

CS/Embedded System 14

[실습] FreeRTOS - Signaling & Mutual Exclusion

LCD 화면에 task1와 task2가 동시에 출력하려면 shared data problem으로 인하여 글씨가 깨진다 이는 두 task가 LCD API를 호출할 때마다 systick interrupt에 의해 선점되기 때문이다 그래서 shared data에 접근할 때 1) interrupt를 껐다가 켜줘야 한다. //Disable/Enable interrupt in FreeRTOS taskENTER_CRITICAL(); // disable taskEXIT_CRITICAL(); // enable // Handling Shared Data Problem in FreeRTOS void Task1( void *pvParameters ) { int i=0; char buffer[64]; while (1) { spr..

CS/Embedded System 2021.12.08

FreeRTOS - Task Management

Sharing Resources 한 화면에 각 task가 동시에 글을 쓰려고 하면 글이 깨짐 여기서 화면이 바로 공유되는 자원 FreeRTOS 이를 이용하면 AWS와도 되는 IoT를 만들 수 있음 특징 source code - 일관성 있고, 깔끔하고, 주석도 많아서 이해하기 좋음 portable : 이식성 (ARM, intel, texas instrument 등 가능) (Assembly로 보관) scalable : 필요한 기능만 설정해서 쓸 수 있게 하여 크기를 작게 (FreeRTOSConfig.h) (최소 footprint=4KB) fully preemptive scheduling : 더 높은 우선순위가 오면 지금 하는 걸 당장 stop copperative scheduling : context swi..

CS/Embedded System 2021.12.08

Real-Time Operating Systems - Semaphore

Real-Time OS (RTOS)가 필요한 이유 [Resource Management] Task scheduling : 액셀, 브레이크 처리 등등 I/O handling [Services & management] Resource sharing ( lock 기법) or task synchronization Timing services Dynamic memory management … System organization with RTOS desktop은 os 위에서 code가 구동되는 것과 달리 임베디드 시스템은 하드웨어 위에서 코드가 구동된다 RTOS application code : example Real-Time의 특징 sensor와 actuator의 시간 제약을 통제해야 함 각 task 별로 주기적..

CS/Embedded System 2021.12.07

Programming Devices - LCD, S1&S2 btn, Joystick

You may have to understand state-machines, timing characteristics, as well as the initialization code and memory map LCD in "MSP-EXP432P4111 boostxl-edumk-ii extension board" - 128x128 pixels - 24bit color data for each pixel +) 추가적인 custom-built sample code Grlib (Graphic Library) LCD Driver (LCD device driver) Additional configurations Bitmap Font Internals char 용 bitmap을 가져와 API에 넣어서 화면에 출력 e..

CS/Embedded System 2021.12.07

[실습] Interrupt & SysTick timer

Interrupt Controller MSP432P4111에서 제공하는 Cortex-M4의 처리방식을 보자 nested vectored interrupt controller (NVIC)로 interrupt를 처리 interrupt 안의 interrupt를 처리 가능 프로그래밍 코드로 제어 가능 -> (핀마다 다르게 내맘대로 가능) multiplexed, shared interrupt를 지원 -> (공유되는 핀들이 microprocessor로 들어와서 interrupt 발생 시) Interrupt Vector Table microprocesser(up)에 interrupt가 오면 ISR의 위치를 찾아서 처리 function point array s1버튼이 눌렸을 때 S1의 ISR의 위치를 찾을 수 있도록 ..

CS/Embedded System 2021.12.07

SW Architecture - RR, Interupt, func-queue scheduling, RTOS

Software architecture for Embedded System event handler : 어떠한 이벤트가 발생했을 때 이를 처리하는 코드를 수행하는 것 software architecture는 이벤트 감지 방법 및 호출 방법에 따라 달라짐 Architecture 1: Round-Robin == polling 방식 순서대로 (우선순위) 특정 이벤트 발생 여부를 감지하고 발생 시 event handler를 실행 장점 : simplicity(딱 일 하나), no shared data, no ISRs (interrupt service routine) 저항을 재는 코드가 전압을 재는 코드 위에 있어서 event handler는 자신의 차례가 올 때까지 기다려야 함.. 다시 확인하고 싶다면 나머지 모..

CS/Embedded System 2021.12.07

I/O Devices - Polling & Pull-up resistor

I/O Devices 하드웨어 구성요소들은 bus라고 불리는 상호 연결된 network를 통해서 메모리를 주고 받음 Memory-mapped I/O를 이용하여 I/O register를 memory address에 접근할 수 있도록 함 따라서 이 register들은 LOAD와 STORE 명령어만 할 수 있음 I/O Device Interface 장치와 네트워크 사이 회로 데이터 전송, 상태 교환, control information data register, status register, control register가 LOAD, STORE 명령어로 접근 status register : 이전에 받은 명령을 다 처리하여 새 명령을 받을 수 있는지 control register : 화면 밝기 제어, 화면을 한..

CS/Embedded System 2021.10.13

Header file에 정의된 macro와 데이터형 이용하기

ex) memory mapped I/O address in “msp.h” #define PERIPH_BASE ((unit32_t) 0x40000000) #define DIO_BASE (PERIPH_BASE + 0x00004C00) #define P1 ((DIO_PORT_Odd_Interruptable_Type *) (DIO_BASE + 0x0000)) ex) GPIO P1의 base address 구하기 periph는 MSP 붙어있는 주변의 여러 하드웨어를 의미 ( GPIO, 통신, watchdog 등등) 모듈 DIO register의 base address = ( PERIPH_BASE + 0x00004C00 ) periph 0x4000000 중에서 0x00004C00 뒤로부터 GPIO 주소가 나옴 P1..

CS/Embedded System 2021.10.13

[실습] Memory Map for P1.0 Red LED

GPIO memory map 범위 : 0x40004C00 (base address) ~ 0x40004FFF 총 크기 : 1024 byte GPIO port : 1번부터 10번까지 ( 0번 없음! ) 핀은 0번부터 7번까지 총 8개 Port Direction Register (PxDIR) 특정 [포트:핀] GPIO 핀 입력/출력 모드 설정 switch button은 입력으로, led on/off는 출력으로 크기 : 1 byte (= 8bit) -> 8개의 핀을 의미 값 : 0b==0, 1b==1, 0h==00000000 Port Output register (PxOUT) 특정 [포트:핀] GPIO 핀의 출력 값 지정 ( 1:HIGH, 0:LOW ) 크기 : 1 byte = 8 bit ( 1bit가 하나의 ..

CS/Embedded System 2021.10.13
728x90
반응형