Home

Making the Most of Limited I/O

image

Contents

1. Making the Most of Limited I O Andrew E Kalman Ph D Slide 1 jar scalable custom 3rd Annual CubeSat Workshop Don t leave Earth without it ge oe mize Cal Poly SLO 2006 Er R op rs TT v Se WWwWw cubesatkit com e PUMPKIN ESS Introduction e Andrew E Kalman President and CTO Pumpkin Inc Author of Creator of the 20 years of embedded systems design and programming experience Contact aek pumpkininc com Slide 2 o ol tar scalable custom 3rd Annual CubeSat Worksho Pe A Don t leave Earth without it a peo i Stomiza b Cal Poly SLO 20 0 a P P i or KIT O ESA NAAA Outline e Overview Presentation Goals e Part I Sharing On Chip Peripherals e Part Il Simultaneous Input amp Output e Part Ill GPIO Pin Personalities e Part IV Efficient GPIO Pin Decoding e Part V Summary Slide 3 o ol tar scalable custom 3rd Annual CubeSat Workshop Pe gt Don t leave Earth without it ort peo k Stomiza bi A Cal Poly SLO 2006 a s gt y AA y i Pon KIT Ge 3 eeNINWeeUbesatkit com C Overview e This presentation is targeted at CubeSat developers who are either in the hardware and software design stages of their CubeSat mission or are looking at ways to add new functionality to an existing CubeSat design e We discuss how to achieve module level peripheral sharing with a minimum of extra circuitry and under efficient software control e We examine individual G
2. ar ele Ustomizs le 3rd Annual CubeSat Workshop Cal Poly SLO 2006 a we gt gt Aaa y Miop KIT Ce ESA NAAA Part Il cont d e CubeSat Kit example cont d Slide 18 scalable customi 3rd Annual CubeSat Workshop r able Cal Poly SLO 2006 CUBE OEE i i i modular SAT Don t leave Earth without it a s gt o so SE ora KIT EA xe Ww cibesatkit com bh Part Il cont d e CubeSat Kit example cont d This single pin driver and sensor fulfills several functions e As an output it independently controls the USB s access to a shared on chip resource USART 1 e As an input it allows us to sense whether USB is present or not even when USART1 is connected to something else The choice of the LVC244A buffer with mode is critical to this function and illustrates how hardware choices are important Detection of USB present requires just a simple task that runs occasionally in concert with all other processes that use USART1 e And it does it all with just a single GPIO pin o ol scalable Pe i 4 Don t leave Earth without it gat a UStOMizapy Slide 19 3rd Annual CubeSat Workshop Cal Poly SLO 2006 5 Y o KITE N KA weeulbesatkit com Part Il cont d e Other examples Multifunction analog digital pins normally configured as digital output pins can also function as analog input pins if e the driving source output of the analog signal can be over driven by
3. VIVE Jesatkit com ogy Q amp A Session Thank you for attending this Pumpkin presentation at the Cal Poly CubeSat Workshop 2006 Slide 29 i i ar scalable CUSto pm SUE Don t leave Earth without it modula Stomiza bi 3rd Annual CubeSat Workshop ye Cal Poly SLO 2006 KIT 2a e PUMPKIN si g gt Aia R or WWwicubesatkit com Notes amp References 1 MSP430x16x block diagram from Tl s MSP430F 1612 datasheets 2 CubeSat Kit User Manual Pumpkin Inc 2005 Slide 30 Don t leave Earth without it mosua scalable customi zap 3rd Annual CubeSat Workshop Cal Poly SLO 2006 E Mor AGU E com Appendix e Speaker information Dr Kalman is Pumpkin s president and chief software architect He entered the embedded programming world in the mid 1980 s After co founding the successful Silicon Valley high tech pro audio startup Euphonix Inc he founded Pumpkin with an emphasis on software quality performance and applicability to a wide range of microcontroller based applications He holds two United States patents is a consulting professor at Stanford University and is invariably involved in a variety of hardware and software projects e Acknowledgements Stanford Professor Bob Twiggs continued support for the CubeSat Kit and his input on enhancements and suggestions for future CubeSat Kit products are greatly appreciated Pumpkin s Salvo and CubeSat Kit customers whose real world ex
4. O pins thus freeing them for other purposes e Use fewer on chip peripherals thus freeing them for other purposes e Potentially run at lower power less activity inside MCU e Design with less mass power and cost for better efficiency e CubeSat Kit example UART SPI and I2C devices are all accessed through USARTO 5 peripheral pins are required plus one additional GPIO pin to prevent I2C corruption while SPI clock and data are on shared pins SCK SCL and MOSTI SDA USART1 is dedicated to USB pre launch or transceiver pre and post launch This allows the CubeSat Kit to listen on USART 100 of the time for incoming commands and data This also facilitates a direct pipe between mass storage SD card on USARTO SPI and transceiver on USART1 UART Slide 14 war scalable Custom 3rd Annual CubeSat Workshop a i able Cal Poly SLO 2006 qdo i 1 i i mod SAT Y Don t leave Earth without it a j f 2 a Mor KIT Ce ARNM UBesatkit com e Part cont d e CubeSat Kit example I2C isolator allows concurrent use of SPI and I2C modules in USARTO peripheral at a cost of one additional GPIO pin VCC SYS CSK Bus Side Local Device Side CS SD ON I2C VCC SYS CubeSat Kit Bus Connector MOSI SDA P3 1 directly from 7 MS P430 Flight MCU Slide 15 3rd Annual CubeSat Workshop Cal Poly SLO 2006 i n tar scalable custom Don t leave Earth without it 100 Miz
5. PIO pins to see how they can perform more than just a single function e We present circuit design techniques that allow GPIO pins to function simultaneously as both inputs and outputs e Examples of how these ideas are implemented in the CubeSat Kit are also presented The emphasis is always on using as few GPIO pins as possible Slide 4 ar scalable Custom 3rd Annual CubeSat Workshop able Cal Poly SLO 2006 cuei A Don t leave Earth without it y z Mop KIT Ce ARNM UBesatkit com e Part Sharing On Chip Peripherals e Modern MCUs are chock full of useful peripherals e e g T s MSP430 e GPIO Clock Module Timer_A3 Timer_B7 USART with UART SPI and I2C modules ADC12 DAC12 DMA Controller e etc e In order to be most efficient viz mass power cost let s use a given peripheral in multiple operating modes instead of using multiple peripherals in single operating modes Slide 5 ular scalable CUstom 3rd Annual CubeSat Workshop lt i able Cal Poly SLO 2006 CUBED no ware ak SAT Y Don t leave Earth without it a j f 2 a Mor KIT Ce ARNM UBesatkit com e Part Sharing On Chip Peripherals MSP430x16x XIN XOUT DVec DVss AVec AVss RST NMI P1 P2 P3 P4 P5 P o Ys Rosc Oscillator 5 as 7 ADC12 DAC12 I O Port 5 6 uta 16 Os sca oo 12 Bit 12 Bit XT20UT i 8 Channels f 2 Channels interrupt 3 as lt 10us Conv f Voltage out punat MCLK MAB l l T
6. SAT Y Don t leave Earth without it q 5 Y o KITE N KA weeulbesatkit com Part cont d e Example triple mode application e UART still camera e SPI magnetometer e 12C ADC solar panel currents e Simple application e Initialize USARTO s UART module for camera request image data from camera and receive it e Initialize USARTO s SPI module for magnetometer select magnetometer get flux data deselect magnetometer e Initialize USARTO s I2C module for ADC get data e repeat e The faster you can communicate with a connected device the quicker you can switch between devices and between modules Slide 10 es scalable Custom 3rd Annual CubeSat Workshop able Cal Poly SLO 2006 qo of i i Y SAT Y Don t leave Earth without it q Z 5 Mo KIT ia apy weeulbesatkit com Part cont d e Gotchas e The re initialization of each module is necessary especially if the source of the previous initialization is unknown or unpredictable Module initialization usually requires several registers to be configured Better to re write the registers completely than assume certain bits are still configured as you need them e With interrupt driven code it s essential to ensure that communications are complete between the module and a connected device before you change to a different module E g if talking at 1200bps N 8 1 to a serial device with 32 byte packets via the UART module you cannot
7. apy a or NAGU sath ora SINN UB esatkit com le Part Il Simultaneous Input amp Output e Basic thinking e Pin A will spend its life as a digital output and I ll dedicate pin B as a digital input to sense condition X e Advanced thinking e By careful design and good programming can sense an important bit of information X on pin A as an input even though normally use that pin as an output Slide 16 es scalable Custom 3rd Annual CubeSat Workshop able Cal Poly SLO 2006 CUBE E i i ae SAT Y Don t leave Earth without it q p Y Mo KITE N i KA weeulbesatkit com Part Il cont d e CubeSat Kit example A single GPIO pin connects USART1 to USB and detects if USB is present P3 7 2 TXD USB lt P6 0 lt RTS USB lt P6 1 6 DTR USB lt P6 2 8 PWE USB lt R5 gt P3 6 9 RXD USB gt P6 3 7 CTS USB gt P6 4 5 r RI USB gt P6 5 3 RST USB gt gt 4 7K gt P1 7 1 y SN74LVC244APWR e P1 7 configured as an output USB is connected to the MCU when P1 7 is LOW and isolated and disconnected from the MCU when P1 7 is HIGH e P1 7 configured as an input If P1 7 is HIGH then USB is present since USB drives VCC IO If P1 7 is LOW USB must not be present because VCC IO is LOW Either way USB remains isolated and disconnected from the MCU while being probed Slide 17 CUBE G UBE Kent ieave faih without
8. d to device A in mode 1 and to device B in mode 2 and bit bang device C in mode 3 via unused GPIO pins with some software found on the web Software peripherals are so cool e Advanced thinking e TIl use peripheral X connected to device A in mode 1 and to device B in mode 2 and by adding a small circuit and using one more GPIO pin can even connect peripheral X to device C in mode 3 This is kinda fun Slide 8 ular scalable CUustomiza 3rd Annual CubeSat Workshop le SAT IS Cal Poly SLO 2006 KITE CUBE O AS Don t leave Earth without it ya ae Sr Se Mo Ae ay com Part cont d e In this example can we use all three modules of a single peripheral in our design Yes e The UART s pins are separate from SPI and 12C so a serial device inherently point to point can be permanently attached to the UART module P3 5 amp P3 4 e SPI devices can be attached to the SPI module P3 3 P3 2 amp P3 1 Each device requires its own chip select signal via a separate GPIO pin e I2C devices can be attached to the I2C module P3 3 P3 1 e To be able to use all three modules our connected devices need to meet a few requirements e The MCU must initiate and terminate all communications e Each device s communications must not be corrupted by the actions of the module or the other devices Slide 9 uas scalable Custom 3rd Annual CubeSat Workshop able Cal Poly SLO 2006 qo of i i ae
9. e TTT IGS a cpu Ella a A a E a a Incl 16 Reg QU 53 ES A rs E Bus l ii yl le i E E E TMS p j j F Hardware TCK Multiplier DMA Wate hdog Timer_B7 Timer_A3 POR Comparator USARTO USART1 Controller Timer SVS A TDVTCLK MPY MPYS 7 CC Reg 3CC te Brownout UART Mode JUART Mode diles MAC MACS 3 Channels 15 16 Bit Shadow SPI Mode SPI Mode TDO TDI Reg 12C Mode SL sl Slide 6 o i scalable custom 3rd Annual CubeSat Worksho Pe 4 Don t leave Earth without it d paa m Stomiza b Cal Poly SLO anne KIT E _ o besatkit com C Part cont d e Sometimes a multi mode peripheral s GPIO pins are uniquely dedicated to a particular mode and sometimes they are shared amongst different operating modes e E g T s MSP430 s USARTO peripheral P3 4 Output UART P3 5 Input P3 3 SCK Output SPI P3 2 MISO Input P3 1 MOSI Output P3 3 Output P3 1 Input amp Output Slide 7 o of i l tar scalable custom 3rd Annual CubeSat Worksho Pe 4 Don t leave Earth without it att peo s Mizapje i Cal Poly SLO 20 0 a s gt y AA y i Pon KIT Ge 3 eeNINWeeUbesatkit com C Part cont d e Basic thinking e TIl use peripheral X connected to device A in mode 1 peripheral Y connected to device B in mode 2 and add another MCU to connect to device C in mode 3 How hard can it be to add another processor e Intermediate thinking e TIl use peripheral X connecte
10. ignal polarities often affect how efficiently you can use single GPIO pins for multiple purposes Slide 26 scalable customi 3rd Annual CubeSat Workshop r able Cal Poly SLO 2006 SAT y Wor KIT A ANWWFcubesatkit com fq a s gt CUBE O Wee Don t leave Earth without it gat node Part V cont d e The CubeSat Kit implements Two UARTs One 12 chain to unlimited I2C devices One SPI chain to on board SD and off board SPI devices Detection and control of the USB interface Control of an 12C isolating interface Control of the transceiver interface Control of power to the transceiver Control of power to the SD card Control of power to a RTC chip Chip select of the SD card with just 12 of the MSP430 s GPIO pins and two peripherals leaving 36 of 48 available GPIO pins and the rest of the peripherals free to the user Slide 27 war scalable Custom 3rd Annual CubeSat Workshop a i able Cal Poly SLO 2006 qdo i 1 i i mod SAT Y Don t leave Earth without it a j f 2 a Mor KIT Ce ARNM UBesatkit com e Notice This presentation is available online in Microsoft PowerPoint and Adobe Acrobat formats at www pumpkininc com content doc press Pumpkin CubeSatWorkshop2006 ppt and www pumpkininc com content doc press Pumpkin CubeSatWorkshop2006 pdf Slide 28 scalable custom 3rd Annual CubeSat Workshop Miz able Cal Poly SLO 2006 sar M wo A Mo KIT E E a A
11. perience with our products helps us improve and innovate e Salvo CubeSat Kit and CubeSat information More information on the Pumpkin s Salvo RTOS and Pumpkin s CubeSat Kit can be found at http www pumpkininc com and http www cubesatkit com respectively More information on the open CubeSat standard and the CubeSat community can be found at http www cubesat info e Copyright notice O 2006 Pumpkin Inc All rights reserved Pumpkin and the Pumpkin logo Salvo and the Salvo logo The RTOS that runs in tiny places CubeSat Kit CubeSat Kit Bus and the CubeSat Kit logo are all trademarks of Pumpkin Inc All other trademarks and logos are the property of their respective owners No endorsements of or by third parties listed are implied All specifications subject to change without notice First presented at the 3 Annual CubeSat Workshop at Cal Poly San Luis Obispo on April 28 2006 Slide 31 ido ol scalable custom 3rd Annual CubeSat Workshop SAT wo Mabie Cal Poly SLO 2006 F P i Mon KIT O ESA NAAA
12. shop E Cal Poly SLO 2006 E KA w cuei o Don t leave Earth without it AS weeuibesatkit com KITE Part IV Efficient GPIO Pin Decoding e Basic thinking e I have been using individual GPIO pins to control major subsystems e g power to power hungry devices e Advanced thinking e Why not use the combination of these individual pins to add functionality without consuming more GPIO pins Slide 23 modular scalable custom 3rd Annual CubeSat Workshop i E Cal Poly SLO 2006 E KA w weeulbesatkit com cun o y Don t leave Earth without it KITE Part IV cont d e CubeSat Kit Example Careful use of decoder pins enabled additional functionality without using any new pins e Initially ON_SD enabled power to the SD card and CS_SD functioned as the SD card s SPI chip select pin e The 12C isolation buffer needed a driver pin Since I2C and SPI are on the same peripheral could the ON_SD and CS_SD signals be used to decode the 3 individual states to support SPI and 12C operation e The solution presented itself as the CS_SD ON_TI2C signal one that selects the SD card when LOW and enables I2C communications when HIGH The complementary nature of the two signals works to our advantage Piggybacking the ON_I2C signal on ON_SD instead would have been an unfortunate choice e The net result is 4 states which fully address the needs of SPI or I2C decoding and minimizing power cons
13. switch to the SPI or I2C modules until a minimum of 267ms i e 1 4s a very long time for an MCU after the last byte is enqueued for sending Devices that require the MCU s constant attention and responsiveness like an RS 232 modem which may deliver incoming characters at any time need dedicated peripherals Slide 11 o of jar scalable cy 3rd Annual CubeSat Worksho Pe A Don t leave Earth without it x ds Stomiza by Cal Poly SLO 200 5 Y o KITE N KA weeulbesatkit com Part cont d e Software Issues e A strictly sequential ordering of device access makes for very simple code because the re initialization of the various modules is clearly laid out But it does not accommodate different sampling rates very well Slide 12 o of jar scalable cy 3rd Annual CubeSat Worksho Pe A Don t leave Earth without it g a Stomiza by Cal Poly SLO anne Es e or Po e KITE Ibesatkit com Part cont d e Software Issues e Amore complete approach uses a scheduler or RTOS e This allows processes to share the modules at arbitrary rates Faster sampling is automatically interleaved with slower sampling Task priorities further simplify scheduling Slide 13 o of jar scalable cy 3rd Annual CubeSat Worksho Pe N f Don t leave Earth without it g ds Stomiza b Cal Poly SLO 2008 Mo KIT Fel Ekt com Part cont d e By using multiple modules of a single on chip peripheral you e Use fewer GPI
14. the digital output without damage and e if the normal recipient of the digital output can be disabled while the analog signal is being sampled Slide 20 o ol l jar scalable cy 3rd Annual CubeSat Worksho Pe 4 Don t leave Earth without it e ds tomizapy 4 Cal Poly SLO 2006 KIT EA j Sr or Ae ay com Part Ill GPIO Pin Personalities e Basic thinking e I have two serial devices need to connect to my MCU one DTE and one DCE Their handshaking signals are exactly opposite so need one set of GPIO for the DTE and one set for the DCE e Advanced thinking e TIl use the same GPIO pins for the DTE and DCE handshaking and will re configure the pins in software based on whether the MCU is communicating with the DTE or DCE device Slide 21 ular scalable Custom 3rd Annual CubeSat Workshop a i able Cal Poly SLO 2006 qdo i 1 i i mod SAT Y Don t leave Earth without it a j f 2 a Mor KIT Ce ARNM UBesatkit com e Part Ill cont d e CubeSat Kit Example Hardware handshaking with USB DTE and transceiver DCE using the same pins e Here the signals flow in the same directions but represent complementary functions based on the RS 232 device s type DTE or DCE The application s UART code must take this into account and sense or drive the handshaking pins appropriately from to DTE from to DCE ICON CEE Slide 22 modular scalable custom 3rd Annual CubeSat Work
15. umption while using only two GPIO pins that had already been allocated to other purposes Slide 24 os scalable Custom 3rd Annual CubeSat Workshop able Cal Poly SLO 2006 qo of i i ae SAT Y Don t leave Earth without it q 5 Y o KITE N KA weeulbesatkit com Part IV cont d SD card ON amp selected other SPI devices deselected C disabled use SPI to access SD card SD card ON amp deselected other SPI devices deselected C enabled use 12C to access any 12C device HIGH 3 3V HIGH 3 3V SD card OFF amp selected I C disabled use SPI to access other SPI devices via other SPI devices CS lines SD card OFF amp deselected other SPI devices deselected C enabled use 12C to access any I2C device Truth Table for SPI C selection when multiple SPI Devices are Present scalable cust Mizap le esatkit com Fo As y fe Slide 25 3rd Annual CubeSat Workshop Cal Poly SLO 2006 Part V Summary e Careful planning in the design stage and good coding can result in reduced GPIO pin count requirements leading to other efficiencies e Any time a connection to an external device is not needed 100 of the available time consider sharing its interface external GPIO pins and internal peripherals with other devices You may save resources in doing so e Reducing GPIO pin requirements can allow you to do more with less e S

Download Pdf Manuals

image

Related Search

Related Contents

ヘッドライトカウル  3A0310B - GMAX II 3900/5900/7900, TexSpray 5900HD  XZÏON - Doknet  Mod: GL6/33  STERLING SP2276A-38S Installation Guide      Poulan 530088740 Chainsaw User Manual  Ulitium Lightkit User Manual English  

Copyright © All rights reserved.
Failed to retrieve file