Presentation is loading. Please wait.

Presentation is loading. Please wait.

RTOS & Applications for LPC2148 Aman Arora Ashmita Sinha Karthik Shankar 1 EE382M | Advanced Embedded Systems Architecture Spring 2011 | Project Presentation.

Similar presentations


Presentation on theme: "RTOS & Applications for LPC2148 Aman Arora Ashmita Sinha Karthik Shankar 1 EE382M | Advanced Embedded Systems Architecture Spring 2011 | Project Presentation."— Presentation transcript:

1 RTOS & Applications for LPC2148 Aman Arora Ashmita Sinha Karthik Shankar 1 EE382M | Advanced Embedded Systems Architecture Spring 2011 | Project Presentation

2 Agenda Objective Overview FreeRTOS Porting MCB2140 & LPC2148 CLI & Applications Results and Status Demo 2

3 Objective To port an RTOS on LPC2148 ARM7 based SOC from NXP Development board - MCB2140 from KEIL To develop applications on top of the RTOS Most importantly, LEARN !!! 3

4 Overview 4 LPC 2148 (ARM7) FreeRTOS FLASH MUSIC LED CLI RTOS Selection Understanding FreeRTOS Understanding MCB2140 & LPC2148 Porting CLI & Application Development Testing & Debugging

5 Tasks and division TaskWho? Choosing a RTOSAman, Karthik, Ashmita Understanding the board and the SOC Aman, Karthik, Ashmita Understanding the concepts of FreeRTOS Aman, Karthik, Ashmita Porting the RTOS and writing the LED Task Karthik, Ashmita The Music TaskAman, Karthik The Flash TaskAman, Karthik Command Line InterfaceAman, Ashmita Porting FatFSKarthik, Ashmita 5

6 FreeRTOS Why FreeRTOS? Free! Active project Low footprint – 4K to 7K Good documentation Features Written mostly in C Supports tasks and co-routines Many communication and synchronization primitives Version 6.1.1 Mini-real time kernel freeRTOSConfig.h 6

7 FreeRTOS Scheduler Supports preemptive, cooperative or hybrid scheduling Threads are maintained in a queue Scheduling algorithm – highest priority first Threads which are runnable and have highest priority are scheduled Threads with same priority run with round robin scheduling Preemption implemented Tick count – Tasks can mention the max time to be blocked Will be waken up after the time 7

8 FreeRTOS Tasks Running, Ready, Blocked or Suspended state Task priority – 0 to (configMAX_PRIORITIES - 1) 0 – lowest APIs xTaskCreate, vTaskResume, vTaskSuspend, xTaskHandle, vTaskDelete Idle task – priority 0 Idle task hook (called during each cycle of idle task) Co-routines Only intended for very small processors with severe RAM constraints Shared stack Complex 8

9 FreeRTOS Inter process communication Queues Passed by value Blocking or Non-Blocking Zero time out creates non-blocking Used in ISRs Mutex With priority inversion Semaphore 9

10 Porting Used FreeRTOS for LPC2888 as reference Existing port used Rowley-GCC compiler Modified Startup.s Reduced stack size for FIQ Kept the same values for PLL Removed EMC configurations Modified SOC specific register addresses (LPC214x.h) Removed extra hardware configurations from prvSetupHardware function (like I 2 S, USB, etc.) Modified compiler dependent ISR definitions Redid project files/makefiles for Keil uVision Reduced the functionalities in the RTOS due to compiler limitations Removed the ErrorChecking task Enabled vTaskDelete 10

11 MCB2140 LPC2148 SD Card Slot Potentiometer Speaker LED COM ports Reset USB/Power 11

12 flash_task(R/W) Communication(Pr ogramming & hyperterminal) music_task 12 led_task (P1:16 –23) LPC2148

13 Program Flow ledTask CLI Task flashTask musicTask mt dm fm Reset Startup.s main 13

14 Command Line Interface Interface to the user through COM port Some commands implemented TOP CLEAR START LED STOP LED START FLASH MT FM DM STOP FLASH START MUSIC STOP MUSIC ECHO 14

15 LED Task Mainly used for debugging purpose LEDs mapped to P1.16 -> P1.23 implement 8 bit counter LED Port Init LED Toggle Delay LED Clear LED Task Delete and Update Task List LED Task Create TASK 15 start led stop led

16 Music Task Uses both ADC & DAC Timer Interrupt period determined based on POT position (Timer1) Registered ISR using VICVectAddr & VICIntEnable registers Potentiometer ADC Timer Interrupt Sine Wave Sample Generation DAC Speaker 16

17 Flash Task Used APIs for SPI and MMC communication (Source: NXP) Modified hardware specific initializations (Init function) CLK freq Block /Sector Configuration Changed bare metal calls to RTOS level calls Resolved conflicts in register addresses 17

18 Flash Task mmc_write_block(block) MMCWR -> data MT FM DM EXIT mmc_write_block(block) mmc_read_block(block) Compare MMCWR & MMCRD mmc_read_block(block) MMCRD -> data Flash Prompt Parse command 18 Update Task List Delete Flash Task

19 Flash Task APIs MMC_Init Send CMD0(Idle State Cmd) CMD1(SEND_OP_C OND) CMD16(SET_BLOC KLEN) MMC_Read_Block Generate Address corresponding to given block number CMD17(READ_SINGLE_ BLOCK) SPI_Receive MMC_Write_Block Generate Address corresponding to given block number CMD24(WRITE_SINGLE _BLOCK) SPI_Send 19

20 FatFS Generic FAT filesystem module for small embedded systems Provides application interface (fopen, fclose, fmount) and disk I/O interface (disk initialize, disk read/write) Found existing implementation for OLIMEX ARM7 board Issues faced: Port was for MMC interface - had different pinout Unable to initialize disk Compiler Issues 20

21 Results and Status Successfully ported FreeRTOS on LPC2148 Created Command Line Interface through UART Successfully developed/ported applications LED Music Flash Block read and write only Struggling with FatFS porting 21

22 Next Time… Port a more complex Operating System Start early on FatFS port!!! Add USB interface to SD card 22

23 References http://www.freertos.org/ http://www.keil.com/mcb2140/ LPC2148 user manual http://efsl.be/ http://ics.nxp.com/support/documents/microcontrollers/pdf/ an10406.pdf http://ics.nxp.com/support/documents/microcontrollers/pdf/ an10406.pdf 23

24 DEMO … 24


Download ppt "RTOS & Applications for LPC2148 Aman Arora Ashmita Sinha Karthik Shankar 1 EE382M | Advanced Embedded Systems Architecture Spring 2011 | Project Presentation."

Similar presentations


Ads by Google