210 likes | 228 Views
Embedded Real Time Software Development. Week 4 Review. Today’s Agenda. Review Development Tools and Turning in H/W ERTSD Vocabulary Tasks and Task States OS Timers Counting Semaphores Binary Semaphores Mutexes I2C Understanding I2C communication
E N D
Embedded Real Time Software Development Week 4 Review
Today’s Agenda • Review • Development Tools and Turning in H/W • ERTSD Vocabulary • Tasks and Task States • OS Timers • Counting Semaphores • Binary Semaphores • Mutexes • I2C • Understanding I2C communication • SHT21 Temperature/Humidity Sensor Operation
ERTSD Vocabulary • What is the difference between a kernel and an operating system? • Compare • Superloops • Foreground/Background Systems • Kernel • Interrupts are (Foreground? Background?) • What makes a function reentrant?
ERTSD Vocabulary • Define Real-Time • Hard Real-Time • Soft Real-Time • What makes software deterministic? • What does the term deterministic have to do with the term Real-Time? • What is the difference between a cooperative kernel and a preemptive kernel?
ERTSD Vocabulary • Five Possible Task States in a Kernel, what does each mean? • Dormant • Ready • Pending • Running • Interrutped
ERTSD Vocabulary • In uC/OS-II which is a higher priority? • 15 • 31 • What do these parameters do in OSTaskCreate()? • void (*task)(void *pd) • void *pdata • OS_STK *ptos • UINT8U prio
ERTSD Vocabulary • What is a semaphore? • Binary • Counting • What is “deadlock” when applied to a kernel? • How can you avoid deadlock? • What is “priority inversion”? • What is a Mutex? Why would you use one?
ERTSD Vocabulary • Explain these functions • OSSemCreate() • OSSemPost() • OSSemPend() • OSSemAccess()
RTOS Demonstration • Volunteers • Timer • Kernel • Idle Task • Task 1 • Task 2 • Main
What is I2C • Multi master, Multi slave serial protocol • Two Wires, SDA & SCL • 7 Bit addresses • Speed • 100 kb/s Standard • 400 kb/s Fast mode • 1 Mb/s Fast mode + • 3.4 Mb/s High Speed mode • 5 Mb/s Ultra-Fast mode
Message Structure • Start Condition indicates the master is setting up communication • Ack, the “sender” releases SDA and the “receiver” pulls it low if no error • Stop Condition lets all devices on the bus know to listen for a Start Condition again
Clock Stretching • After receiving last data bit, the slave holds the clock line low until it is ready. • Ack is set to the correct state, usually 0 • Clock line is released for master to continue
Repeated Start Condition • Used when more than one message must be sent to complete an operation. • e.g. reading a byte from an EEPROM Master, Slave, S=Start, P=Stop <S><DevAddr><ACK><MemoryAddr><ACK> <S><Data><ACK><Data><ACK><Data><NAK><P>
Real Life Example SHT-21 • Measures temperature and humidity • Fast mode I2C (up to 400 kb/s)
Addressing & Commands • 7 Bit address is 0b1000000 • Address to write 0b10000000 or 0x80 • Address to read 0b10000001 or 0x81 • Commands:
Why are there 2 measurement commands? • 4 mS Hold, freezes I2C bus for 160 potential message bytes • 85 mS Hold, freezes I2C bus for 3400 potential message bytes • The SHT-21 is not our only I2C device on this board