Home
Using PE to quickly use common communication interfaces on Kinetis
Contents
1. I2C_MasterSendBlock and I2C_MasterReceiveBlock all receive the pointer returned from I2C_Init 3 Existing PE sample There are plenty of examples on how to use PE LDD components to build up working demos these demos are very similar from one to another so once you learned one example you can apply to the others Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 8 Freescale Semiconductor Inc Existing PE sample 3 1 12C example The I2C PE example demonstrates how to use processor expert to generate low level driver code and combine it with higher level user code to implement read and write to externally connected accelerometer on K60 tower board This demo uses three LDD component that is I2C timer and Serial LDD components serial component is used to implement a user console so we can print out some message on console with printf while timer component is used to implement time out mechanism when reading or writing to accelerometer The PE configuration for I2C component is similar as Figure 4 while timer component and serial component configuration is as shown in Figure 7 and Figure 8 here timer component uses the periodic interrupt timer on Kinetis to implement a 1 second time interrupt The serial component uses PTC17 and PTC16 as the UART port and configures UART setting as 38400 8N1 this UART port actually connects to elevator signals on K60 TWR board and are routed to UART port on TWR
2. e MasterReceiveBlock e SelectSlaveDevice e GetError Events handler e OnMasterBlockSent e OnMasterBlockReceived e OnError Of course you can also select to generate code for more methods or events as you wish Finally after you have finished configuring the I2C LDD components as well as CPU components and there are no configuration errors popped up you can right click ProcessorExpert pe and click Generate Processor Expert Code then PE will automatically generate initialization code component method and event handlers for you Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 6 Freescale Semiconductor Inc PE basics Basic Advanced Expert ih 7 E MasterSendBlock MasterGetBlockSentStatus MasterReceiveBlock MasterGetBlockReceivedStatus SlaveSendBlock SlaveGetBlockSentStatus SlaveGetSentDataNum SlaveCancelTransmissionBlock SlaveReceiveBlock SlaveGetBlockReceivedStatus SlaveGetReceivedDataNum SlaveCancelReceptionBlock SelectSlaveDevice GetError CheckBus GetStats ClearStats Main generate code generate code don t generate code don t generate code generate code don t generate code generate code don t generate code don t generate code don t generate code don t generate code don t generate code don t generate code don t generate code don t generate code don t generate code generate code generate code don t generate code don t generate code
3. LDD components following is a summary e Each LDD component includes a Init method to initialize appropriate peripheral and driver and a Deinit method to deinitialize appropriate peripheral and driver e The Init method returns a pointer to driver s device structure which should be passed as the first parameter for each component s method e The Init method has one parameter UserDataPtr which can hold user s own data and this pointer is then returned back as a parameter in component s events Take the I2C LDD component as an example first you can configure I2C module properties under component inspector view configure things like the following see Figure 4 e Whether I2C works as master or slave e Addressing mode 7 bit or 10 bit e Target device slave address this is slave address of the specific device you are communicating for example the MMA7660 accelerometer on TWR K6ON512 e Pins used for I2C signals normally pins for one peripheral module can be multiplexed on different package pins so here you can select which one according to what you allocated on your board e Configure the divide ratio to get your peripheral communcation clock for example I2C module is hooked on bus clock which may be 50 MHz if you run MCU at 100 MHz so you need to provide the divide ratio to get desired I2C clock say 50 kHz Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 Freescale Semiconductor I
4. SER board For signal connection details please check the board schematic and user manual for TWR K6ON512 Ee CodeWarrior Projects 25 Project Panel 3 O Sy component Inspector 53 Basic Advanced Expert fh Y 7 E aga a 2c 2 Documentation Module name PIT PIT gt Generated Code Counter PIT_CVALO PIT_CVALO gt MK60DN512Z_INTERNAL_RAM Counter direction Down Project Headers Counter width 32 bits Project Settings value type Optimal uint32_t Sources El Input clock source Internal a gy Pro xpert pe Counter frequency 24 MHz 24 MHz B S Configurations El Counter restart En f INTERNAL _RAM Period device PIT_LDVALO PIT_LDVALO INTERNAL FLASH Period Le 4 1sec H aa gt Operating System et Disa B amp cpus E Initialization Bo MD10 Enabled in init code yes Cpu K60DN512ZVMD 10 Auto initialization a E Embedded Components Event mask BB 12c 12C_LDD E TIMER TimerUnit_LDD TIMER i ConsoleUART Serial_LDD i ReferencedRSESystems xml X B SzAnslweienninteMansnar anranfa hd Figure 7 Timer component configuration Yy component Inspector 33 Basic Advanced Expert h Y 7 E Ge r2c Documentation UART3 Generated_Code El Interrupt service event Enabled gt MK60DN5 12Z_INTERNAL_RAM Interrupt RxD priority medium priority 8 gt Project Headers Interrupt TxD priority medium priority 8 Project Settings Interrupt Error priority medium priority
5. event handlers for your module In the following sections examples will be given on how to use PE to configure these communication modules and auto generate code which can be used in baremetal applications 2 PE basics This section provides some basics on how to use PE before moving on to more advanced topic of using logic device drivers under PE for configuring communcation interfaces 2 1 Create a new PE project You can create a new PE project under Codewarrior IDE 10 2 with the following steps Click File gt New gt Bareboard project and type your project name Select your device such as MK60DN512Z for the 100MHz family K60 device Choose the debugging connections such as P amp E Multilink OSJTAG or Segger J link In rapid application development page select processor expert and click next Choose the MCU pin variant for the specific package device you are using for example 144BGA and click finish BWN Now you have created a new project with PE support Under project panel you can unfold ProcessorExpert pe and left click the CPU component then you will find that CPU properties methods events are displayed in the component inspector where you can configure in a graphical user interface See Figure 1 For the CPU component you can configure the following settings 1 Clock settings whether to use internal or external oscillator which value is used and which system clock you expect to run at 2 CPU interrupts
6. 1_CTS_b SDHC BR INTERNAL_FLASH i z E Slave select H E Operating System Pin PTE4 SPI1_PCSO UART3_TX SDHCO_ PTE4 SPI1_PCSO UART3_TX SDHCO_ IS Cpus Active level Low H 4 Cpu MK40DX256ZVMD 10 E Attribute set E Cpu MK40Dx256ZVMD 10 Width 8 bits H E Embedded Components MSE first yes H ConsoleUART Serial_LDD Clock polarity Low Ss SM1 SPIMaster_LDD Clack phase Capture on leading edge ESS lave LDD Parity None ReferencedRSESystems xml HW input buffer size Max buffer size Size 16 B SaAnalysispointsManager apconfig HW input watermark 1 HW output buffer size Max buffer size Size 16 HW output watermark 1 Initialization Enabled in init code yes Auto initialization no E Event mask OnBlockSent Enabled OnBlockReceived Enabled OnError Enabled Figure 9 SPI master component configuration SPI1 Figure 10 SPI slave component configuration Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 12 Freescale Semiconductor Inc Conclusion 4 Conclusion Processor expert is a quite user friendly tool which helps you configure hardware operation in a GUI interface and generate useful APIs which you can use in your application With the included logic device component LDD you can quickly generate driver code for nearly every available modules on Kinetis after you configured the component according to hardware connectio
7. 8 Sources E Settings A Sy p orExpert pe Data width 8 bits El Configurations Parity None Hh INTERNAL_RAM Sup bis i TERNAL FLASH Loop mode Normal Operating System Baud rate 38400 baud 38400 baud Stop in wait mode no Eh Cpus Idle line mode Starts after start bit Cu mK600N512ZvM0 10 E Receiver Enabled B Cpu MK60DN512ZvMD 10 RxD PTC16 CAN1_RX UART3_RX ENETO_ PTC16 CAN1_RX UART3_RX ENETO_ B Embedded Components E Transmitter Enabled B 12c 12 _LDD TxD PTC17 CAN1_TX UART3_TX ENETO_ PTC17 CAN1_TX UART3_TX ENETO_ gg TIMER TimerUnit_LDD TIMER E Initialization i ConsoleUART Serial_LDD Enabled in init code yes ReferencedRSESystems xml Auto initialization no i B SaAnalysispointsManager apconfig E Event mask T srr OnBlockSent Enabled OnBlockReceived Enabled OnTxComplete Disabled OnError Disabled OnBreak Disabled Figure 8 Serial component configuration Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 Freescale Semiconductor Inc 9 Existing PE sample The main work for the demo is done in the main function in ProcessorExpert c file here it first calls PE_low_level_init for common register initialization then calls each LDD component s Init function to initialize that component This commonly includes initialization of such things as pin multiplex for modules which have external connections and module initialization itself like UART baud rate I2C address operatio
8. CForFreescaleSemiconductor hibbertgroup com Document Number AN4450 Rev 0 01 2012 Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductors products There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document Freescale Semiconductor reserves the right to make changes without further notice to any products herein Freescale Semiconductor makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit and specifically disclaims any liability including without limitation consequential or incidental damages Typical parameters that may be provided in Freescale Semiconductor data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Freescale Semiconductor does not convey any license under its patent rights nor the rights of others Freescale Semiconductor products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications inten
9. FB_AD D Cpu MK40DX256ZVMD 10 Active level Low i Cpu MK40DX256ZVMD 10 4 CS external demultiplexer Disabled E E Embedded Components Attribute set list 1 ConsoleUART Serial_LDD E Attribute set 0 M1 SPIMaster_LDD Width 8 bits SS1L SPISlave_LDD MSB first ves ReferencedRSESystems xml Clock polarity Low E SaAnalysispointsManager apconfig Clock phase Capture on leading edge Parity None Chip select toggling no Clock rate index 0 Delay between chars index 0 CS to CLK delay index 0 CLK to CS delay index 0 Clock rate 5 333 us 5 333 ps Delay between chars 32 0 us 32 us CS to CLK delay 4 0 us 4us CLK to CS delay 4 0 us 4us HW input buffer size Max buffer size Size 16 HW input watermark 1 HW output buffer size Max buffer size Size 16 2c ES sP gt Documentation Interrupt service event Enabled Generated_Code Input interrupt priority medium priority 8 gt MK40DX256Z_INTERNAL_RAM Output interrupt priority medium priority 8 Project_Headers Settings H E Project_Settings E Input pin Enabled H E Sources Pin PTE3 SPI1_SIN UART1_RTS_b SDHC PTE3 SPI1_SIN UART1_RTS_b SDHC gy ProcessorExpert pe E Output pin Enabled ie oiri o Pn PTE1 SPI1_SOUT UART1_RX SDHCO PTE1 SPI1_SOUT UART1_RX SDHCO BB INTERNAL_RAM B Clock pin i police Pin PTE2 SPI1_SCK UART1_CTS_b SDHC PTE2 SPI1_SCK UART
10. Ptr TDataState DataState uint8 t Address uint8 t RegCount uint8 t Buffer DataState gt Sent FALSE Send I2C address I2C MasterSendBlock I2CPtr amp Address sizeof Address LDD I2C NO SEND STOP Wait till data sent or continue when timeout while DataState gt Sent amp amp Timeout TimerPtr reset timer TIMER ResetCounter TimerPtr DataState gt Received FALSE Receive data from device I2C MasterReceiveBlock I2CPtr Buffer RegCount LDD I2C SEND STOP Wait till data received or continue when timeout while DataState gt Received amp amp Timeout TimerPtr reset timer TIMER ResetCounter TimerPtr return TRUE Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 10 Freescale Semiconductor Inc Existing PE sample 3 2 SPI example The SPI example demonstrates how to use SPI master and SPI slave LDD components to implement communciation between SPI master and slave This demo works on TWR K40X256 You need to connect PTA17 PTA16 PTA15 and PTA14 with PTE1 PTE3 PTE2 and PTE4 to implement SPI master and slave communication Figure 9 and Figure 10 are SPI master and SPI slave component configuration view here we have configured port used for SPI master as well as bit width of each transfer clock phase and polarity SPI clock speed While for SPI slave we just need to configure the same bit width clock phase and polarity as SPI master to make
11. ash clock 10 48576 10 48576 MHz E be fiash clock frequency MHz for timing of internal fiash f M Enableint i M DisableInt Ml GetLLswakeUpFiags B Mc m A A A IE al Un s gt i Figure 1 Component inspector view of CPU 2 2 Adding LDD component After configuring overall settings for your CPU component you also need to add peripheral modules in your project so it can do some useful work This can be done by adding modules in components library see Figure 2 The components in component libraries are grouped into several categories CPU external devices components for devices externally connected to CPU such as sensors memories displays CPU interal peripherals include components using any of on chip peripherals of the CPU Logic device drivers LDD offer the user the hardware abstraction layer for baremetal applications as well as RTOS applications Operating system components related to processor expert interaction with OS running on the target Software components encapsulating pure software algorithms The LDD components are further divided into several sub catogories based on functions of each group such as communication converter DMA human interface etc This application note will focus on how to use the communication LDD component to speed up your design Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 Freescale Semiconductor Inc 3 PE ba
12. ded to support or sustain life or for any other application in which failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application Buyer shall indemnify Freescale Semiconductor and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claims alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part RoHS compliant and or Pb free versions of Freescale products have the functionality and electrical characteristics as their non RoHS complaint and or non Pb free counterparts For further information see http www freescale com or contact your Freescale sales representative For information on Freescale s Environmental Products program go to http www freescale com epp Freescale and the Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners 2012 Freescale Semiconductor Inc ey freescale K
13. don t generate code don t generate code Figure 5 Method page for 12C LDD component Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 Freescale Semiconductor Inc 7 Existing PE sample NS omponent Inspector 2 5 a Basic Advanced Expert fh IT je OnMasterBlockSent generate code Event procedure name 12C_OnMasterBlockSent OnMasterBlockReceived generate code Event procedure name OnSlaveBlockSent OnSlaveBlockReceived OnSlaveRxRequest OnSlaveTxRequest OnSlaveGeneralCallAddr don t g OnError generate code Event procedure name I2C_OnError Figure 6 Event page for 12C LDD component 2 4 PE generated code for LDD components There are some common things among different LDD components following is a summary LDD TDeviceData I2C Init LDD TUserData UserDataPtr void I2C_Deinit LDD TDeviceData DeviceDataPtr LDD TError I2C MasterSendBlock LDD TDeviceData DeviceDataPtr LDD TData BufferPtr LDD I2C TSize Size LDD I2C TSendStop SendStop LDD TError I2C MasterReceiveBlock LDD TDeviceData DeviceDataPtr LDD TData BufferPtr LDD I2C TSize Size LDD I2C TSendStop SendStop void I2C OnMasterBlockSent LDD TUserData UserDataPtr void I2C OnMasterBlockReceived LDD TUserData UserDataPtr As you can see I2C_Init receives a pointer in which you can pass user data it returns a pointer to device data struture And I2C_Deinit
14. ion PE low level init Call Init routine for each component ConsoleUART DeviceData ConsoleUART Init NULL masterDevData SM1 Init NULL slaveDevData SS1 Init NULL some printfs to output message on console Call SendBlock ReceiveBlock GetBlockSentStatus and GetBlockReceivedStatus here for either SPI master or slave Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 Freescale Semiconductor Inc 11 Existing PE sample Ta Ny Component Inspector x4 12c B SPI H E Documentation Interrupt service event Enabled Generated Code Input interrupt priority medium priority 8 gt MK40DX256Z_INTERNAL_RAM Output interrupt priority medium priority 8 Project Headers Settings H E Project Settings E Input pin Enabled gt Sources Pin PTA17 SPIO_SIN UARTO_RTS_b FB_ PTA17 SPIO_SIN UARTO_RTS_b FB_ E Y ProcessorExpert pe E Output pin Enabled Ee n gis Pin PTA 16 SPIO_SOUT UARTO_CTS_b FB PTA16 SPIO_SOUT UARTO_CTS_b FB Be InTERNAL_RAM E Clock pin i ini Pin PTA15 SPIO_SCK UARTO_RX FB_AD3 PTA15 SPIO_SCK UARTO_RX FB_AD3 BP INTERNAL FLASH Operating System B Chip select ist E Chip select 0 EE Cpus Pin PTA14 SPIO_PCSO UARTO_TX FB_AD PTA14 SPIO_PCSO UARTO_TX
15. k as you expected you can specify on a abstract view of how your system works like which frequency I2C runs which pins are allocated for the I2C port PE will then help generate code to program associated hardware registers to accomplish your task such as programming prescaler value to divide down MCU bus clock to get the required I2C frequency setting pin multiplex register to assign I2C port on a specific GPIO port There is a lot of documentation and example code to get started with PE After installing the latest Codewarrior 10 2 IDE you can find Processor expert user manual under lt CW installation folder gt MCU Help PDF There is also plenty of PE example projects under lt CW installation folder gt MCU N 2012 Freescale Semiconductor Inc J w freescale PE basics CodeWarrior_Examples Processor_Expert Kinetis includes a collection of communication modules on chip to ease connectivity requirement from MCU with outside world such as UART SPI IIC Ethernet and CAN From an application point of view what you need is some way to transmit or receive data with one of the communcation modules But there is a big learning curve if you need to read chip reference manual then write code to access hardware registers for accomplishing this job PE helps to bridge the gap you just need to pull in existing logic devices components into your project and configure the properties and write methods and
16. n mode After these initialization we then are able to call printf or some wrapper functions like ReadAccRegs and WriteAccRegs to access accelerometer LDD TDeviceData ConsoleUART Devicedata void main void LDD TDeviceData I2CPtr NULL LDD TDeviceData TimerPtr NULL common register initialization not clock module initialization which is already done in _ init hardware before we enter main PE low level init initialize UART port such as configure pin multiplex function and UART registers for a specific baud rate this will return a pointer to LDD TDeviceData structure ConsoleUART DeviceData ConsoleUART Init NULL some printfs to output messages to console I2C initialization similar to serial component I2CPtr I2C Init amp DataState Timer initialization similar to serial component TimerPtr TIMER Init NULL Register read and write functions we implement for accelerometer it will call PE generated routines of I2C and timer component ReadAccRegs I2CPtr TimerPtr amp DataState ACC MODE REG ADDR ACC REG SIZE Data WriteAccRegs I2CPtr TimerPtr amp DataState ACC MODE REG ADDR ACC REG SIZE Data The implementation of ReadAccRegs and WriteAccRegs are quite straightforward it just calls routines generated from the I2C and timer component The code for WriteAccRegs is similar to ReadAccRegs listed here static bool ReadAccRegs LDD TDeviceData I2CPtr LDD TDeviceData Timer
17. nc 5 PE basics S lt omponeni ANSPECLO X ower ater Name de o Detwlgs CS Basic Advanced Expert lm Y 7 A 12C channel 12c0 12c0 Interrupt service Enabled Interrupt priority medium priority 8 Settings Mode selection MASTER MASTER mode Enabled Initialization Address mode 7 bit addressing Target slave address init 4c H SLAVE mode Disabled Pins SDA pin SDA pin PTDS 12C0_SDA UARTS_TX FB_A17 PTDS9 12CO0_SDA UARTS_TX FB_A17 SCL pin SCL pin PTD8 I2C0_SCL UARTS_RX FB_A16 PTD8 I2CO_SCL UARTS_RX FB_A16 Internal frequency multiplier factor 24 MHz 24 MHz Bits 0 2 of Frequency divider register 111 Bits 3 5 of Frequency divider register 100 SCL frequency 50 kHz Clock conf 0 50 kHz SDA Hold Clock conf 0 2 708 us SCL start Hold Clock conf 0 9 917 us SCL stop Hold Clock conf 0 10 042 us Initialization Enabled in init code yes Auto initialization no gt See Se Figure 4 Property configuration for 12C module Then under Methods and Events page in component inspector see Figure 5 and Figure 6 you can configure which method and event handler you want PE to help generate the code template As you can see by default PE will choose to generate basic code for the LDD component In the case for I2C LDD component PE generates the following methods and events handler Methods e Init e Deinit e MasterSendBlock
18. nnen en Freescale Semiconductor Document Number AN4450 Application Note Rev 0 01 2012 Using PE to quickly use common communication interfaces on Kinetis by Wang Hao System and Application Microcontroller Solutions Group Contents 1 Introd uction 1 Utrodieedmrrsernmsr ereen 1 This application note describes how to use Processor Expert in PERM 2 Codewarrior IDE 10 2 to quickly get started with common 21 Create a new PE ptole t nsveenninene 2 communication modules available on Kinetis Since ColdFire shares similar interface as Kinctis the materal covered in 22 Adding LOD conipomenit nara mars 3 this Application Note also applies to ColdFire 2 3 Common things for LDD Processor expert PE provides user with an efficient OMPONG areni s development environment for rapid application development 2 4 PE generated code for LDD of the embedded application As one of the plug ins of COMME ONE N s aia 8 Codewarrior IDE PE can be used to generate code from the 3 Existing PE Sanne sscsssassssicnnivuartesnasuevaveeisateaeoacb eed 8 Embedded Components through a graphical user interface The embedded components encapsulate the initialization and Bek OC emeente 9 functinality of embedded system basic elements such as MCU core on chip peripherals standalone peripherals pure 3 2 APESKOMPIE enenu 10 software algorithm etc Instead of bothering with how to A Coneis aiota dt Nees 13 program registers to make a specific module wor
19. ns on your board and required operation details of the module You can use the PE examples installed under Codewarrior folder as a starting point and implement your desired function by just calling the generated APIs from PE Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 Freescale Semiconductor Inc 13 How to Reach Us Home Page www freescale com Web Support http www freescale com support USA Europe or Locations Not Listed Freescale Semiconductor Technical Information Center EL516 2100 East Elliot Road Tempe Arizona 85284 1 800 521 6274 or 1 480 768 2130 www freescale com support Europe Middle East and Africa Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen Germany 44 1296 380 456 English 46 8 52200080 English 49 89 92103 559 German 33 1 69 35 48 48 French www freescale com support Japan Freescale Semiconductor Japan Ltd Headquarters ARCO Tower 15F 1 8 1 Shimo Meguro Meguro ku Tokyo 153 0064 Japan 0120 191014 or 81 3 5437 9125 support japan freescale com Asia Pacific Freescale Semiconductor China Ltd Exchange Building 23F No 118 Jianguo Road Chaoyang District Beijing 100022 China 86 10 5879 8000 support asia freescale com For Literature Requests Only Freescale Semiconductor Literature Distribution Center 1 800 441 2447 or 1 303 675 2140 Fax 1 303 675 2150 LD
20. pt priority medium priority 8 B E Configurations E Settings A MK60DN512ZVMD 10 Mode selection MASTER H E Operating System E MASTER mode Enabled H S cpus E Initialization DB Cpu MK60DN512ZVMD 10 Address mode 7 bit addressing E E gt Embedded Components Target slave address init HI SLAVE mode SB 12 12 _LDD ie 43 AS1 Serial_LDD 2 E SDA pin RED SDA pin PTD9 12CO_SDA UARTS_TX FB_A17 _ PTD9 I2CO_SDA UARTS_IX FB_A17 B ReferencedRSESystems xml E SCL pin id SaAnalysispontsManager apconfig SCL pin PTD8 12CO_SCL UARTS_RX FB_A16 PTD8 12CO_SCL UARTS_RX FB_A16 SPI Internal frequency multiplier factor 24 MHz 24 MHz Bits 0 2 of Frequency divider register 111 E Bits 3 5 of Frequency divider register SCL frequency Clock conf 0 50 kHz SDA Hold Clock conf 0 2 708 us SCL start Hold Clock conf 0 9 917 us L SCL stop Hold Clock conf 0 10 042 us amp CPU Internal Peripherals E Initialization E Logical Device Drivers Enabled in init code yes Communication Auto initialization no CAN_LDD Logical Device Driver Ethernet_LDD Logical Device Driver me POPE EEN tn ESAn Serial_L Add to project with Wizard 24 Problems Tasks El console Xa Properties 48 Remote Systems 1e Target Tasks Eg Progress SPIMas SPISlav z Pi t rocessor Exper Collapse all Figure 3 Adding a LDD component 2 3 Common things for LDD components There are some common things among different
21. sics ae Logical Device Drivers EG Communication CAN_LDD Logical Device Driver ze Ethernet_LDD Logical Device Driver Logical Device Driver m soHc_LoD Logical Device Driver EN Serial_LDD Logical Device Driver i SPIMaster_LDD Logical Device Driver 5 SPISlave_LDD Logical Device Driver a SSI_LDD Logical Device Driver USB_LDD Logical Device Driver E Converter Display gt DMA Human Interface gt Measurement E Memory E Port I O Ee Security Timer H E Operating Systems H E sw E a a 5 5 z 5 No project focused filtering disabled Figure 2 Components libraries view Adding a new LDD component is quite easy just choose one of the components in component library right click the component and choose add to project then you will see that component displayed under Embedded components then you will be able to configure the properties methods and events of the LDD component the similar to the CPU component see Figure 3 Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 4 Freescale Semiconductor Inc PE basics Ee CodeWarrior Projects Project Panel 3 N m D Component Inspector x Basic Advanced Expert fh v l amp amp Y properties Methods Events gt Project Headers gt Project Settings 12C channel 12c0 Sources El Interrupt service Enabled gy Pi Expert pe Interru
22. such as NMI interrupts these are different from peripheral interrupts which are mostly configured in peripheral components 3 External bus configures chip select to use for external devices and what memory map assigned to those external device 4 Link file setting configures memory map for your embedded system including address range for internal flash internal SRAM and it also allows to configure stack and heap size Using PE to quickly use common communication interfaces on Kinetis Rev 0 01 2012 2 Freescale Semiconductor Inc PE basics Eig CodeWarrior Proje 25 Project Panel 3 SS Component Inspector 23 Basic Advanced Expert m Y 7 E Properties N Methods Events Build options Used i can tenet Crt i Ethernet CPU type MK60DN512ZVMD 10 Er 12C Clock settings Oef k60 _pe_demo Initialization priority minimal priority 15 H E Documentation Watchdog disable yes Generated Code CPU interrupts resets ES MK60N512VMD 100_INTERNAL_RAM External Bus Disabled S Project_Headers Clock configurations 1 H E Project_Settings Clock configuration 0 Sources E Clock source setting configuration 0 BARBY Pro Expert pe MCG mode FEI 8 Configurations B System docks Core clock 20 97152 20 97152 MHz i SATE RAM Bus clock 20 97152 20 97152 MHz H E Operating System External bus clock 10 48576 10 48576 MHz A cpus Fl
23. sure we get correct data The APIs generated for SPI master and SPI slave are as follows This is similar as that for I2C it has Init routine for the component as well as SendBlock and ReceiveBlock routine for sending and receiving data on SPI master or slave It also includes GetBlockSentStatus and GetBlockReceivedStatus routines for checking whether data sending and receiving has finished or not SPI master LDD_TDeviceData SM1 Init LDD_TUserData UserDataPtr LDD TError SM1_ReceiveBlock LDD TDeviceData DeviceDataPtr LDD TData BufferPtr uint16 t Size LDD_TError SM1_SendBlock LDD Size bool SM1_GetBlockSentStatus LDD TDeviceData DeviceDataPtr bool SM1 GetBlockReceivedStatus LDD TDeviceData DeviceDataPtr TDeviceData DeviceDataPtr LDD TData BufferPtr uint16 t SPI slave LDD TDeviceData SS1 Init LDD TUserData UserDataPtr LDD TError SS1_ReceiveBlock LDD TDeviceData DeviceDataPtr LDD TData BufferPtr uint16 t Size LDD_TError SS1 SendBlock LDD Size bool SS1_GetBlockSentStatus LDD TDeviceData DeviceDataPtr bool SS1 GetBlockReceivedStatus LDD TDeviceData DeviceDataPtr TDeviceData DeviceDataPtr LDD TData BufferPtr uint16 t The main function implementation is also similar as I2C example Main flow is as follows LDD TDeviceData ConsoleUART DeviceData void main void LDD_TDeviceData slaveDevData LDD_TDeviceData masterDevData common register initializat
Download Pdf Manuals
Related Search
Related Contents
Manitowoc Ice J-1800 User's Manual Extrudeuse de colle thermoplastique EX07 - TG I57c deutsch TG I57c english TG I57c français neoStampa - Inèdit Software SL Tripp Lite 93-2007 (200106010) User's Manual Split 7000 Le dépôt de bilan Altinex PNP350 User's Manual Copyright © All rights reserved.
Failed to retrieve file