Home
EMMA Mobile1 Application Note UART Interface
Contents
1. Send and Receive em1 uart send em1 uart recv Y Print UART receive error em1 uart print error NN Figure 3 3 Example of Send and Receive About the UART function please refer to the Appendix A UART Driver Function Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 3 2 2 Operation Detail 1 Set the UART configure The process calls the em1_uart_set_config function 30 78 The em1_uart_set_config function finishes the following functions for UARTO Set parity EM1 UARTO LCR 5 3 000b Set stop bit EM1 UARTO LCR 2 0b Set length EM1 UARTO LCR 1 0 11b Set divisor EM1 UARTO_LCR 7 1b EM1 UARTO DLM 0 EM1 UARTO DLL 0x7C EM1 UARTO LCR 7 Ob Enable receive error EM1 UARTO IER 0x4 Disable FIFO EM1 UARTx FCR O0 Ob Disable RTS and CTS EM1 UARTx MCR 5 Ob EM1 UARTx MCR 1 1b 2 Get UART configure The process calls the em1 uart get config function none parity 1 stop bit 8 bits 115200 bps Disable the automatic flow control Enable RTS The em1_uart_get_config function finishes the following functions for UARTO Get parity parity EM1 UARTO LCR 5 3 Get stop bit stop bit EM1 UARTO LCR 2 Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 31 7
2. eessssse 33 Figure 3 5 Example of Automatic Flow Control 34 Figure 3 6 Hardware Connection of Simulate Flow Control 37 Figure 3 7 Example of Simulate Flow Control 38 Figure 3 8 Example of Automatic Flow Control with DUMAS 42 Foure A UART IMirA E 49 Figure A 2 Set tbie COnllgufe uii veu s dot tote oerte E TE 52 Figure A 3 Get the COMMU ues ennemi tetas darsi tem eine tubos onc BER ten 54 Figure A 4 Send a Character nennen nennen nna nnn nnne nnn naa 57 Figure A 5 Receive a Character oe do tuos V Dat ee a ee 58 Figure A 6 Enable Flow Cont lic iiic tee edet oet lune rs eee te evt ever ee 59 Figure A 7 Disable Flow Control nes menant aN 61 Application Note 819893EJ1VOANOO INDEX 7 78 Eigure A 9 Enable FIFO iss sia a et ee ae ed a ee See 63 Figure A9 Disable Miu cvm 65 Figure A 10 Send a Character with Simulate Flow Control 67 Figure A 11 Received a Character with Simulate Flow Control 69 Figure A 12 Clear the Receive Error 70 Figure A 13 Print the Receive Error 71 Figure A 1414 Enable UART DMA inae otc eta MER cxtra eres e Taraa E 75 Figure A 15 Disable UART DMA 77 Application Note 19893EJ1VOANOO Chapter 1 Introduction 8 78 Chapter 1 Introduction 1 1 Outline This document introduces the Universal Asynchronous Receiver Transmitter UART of EMMA Mobile How to send and receive characters How to send and
3. Enable RTS EM1 UARTx MCR 1 1b Application Note 819893EJ1VOANOO Appendix A UART Driver Function 62 78 A 4 8 Enable FIFO Function Name em1 uart enable fifo Format DRV RESULT em uart enable fifo struct st UART SETTING uart value Argument Parameter Type I O Detail struct st_UART_SETTING 1 UART information Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Application Note S19893EJ1VOANOO Appendix A UART Driver Function 63 78 Flow Chart d Start gt e uart is in 0 1 or 2 Yes No Reset receive and send buffer of FIFO EM1 UARTx FCR 2 1b EM1 UARTx FCR 1 1b trigger number 1 4 8 or 14 Set 64 bytes FIFO mode Set 16 bytes FIFO mode EM1 UARTx FCR 5 1b EM1 UARTx FCR 5 0b Set trigger number EM1 UARTx FCR 7 6 trigger v Enable FIFO EM1_UARTx_FCR O0 1b Rs Figure A 8 Enable FIFO Note x is 0 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 Reset the buffer of FIFO Note x is 0 1 or 2 Reset the transfer buffer of FIFO EM1 UARTx FCR 2 1b Reset the receive buffer of FIFO EM1 UARTx FCR 1 1b Application Note 819893EJ1VOANOO Appendix A UART Driver Function 64 7
4. 2 Get the UART configure Note x is 0 1 or 2 Get parity parity EM1_UARTx_LCR 5 3 Get stop bit stop bit EM1_UARTx_LCR 2 Get length bit length EM1 UARTx LCR 1 0 Get divisor DLM EM1 UARTx DLM DLL EM1 UARTx DLL Get flow control mode EM1 UARTx MCR 5 Application Note 819893EJ1VOANOO Appendix A UART Driver Function 56 78 A 4 4 Send a Character Function Name em uart send Format DRV RESULT em1 uart send uchar num uchar c Argument Parameter Type VO Detail num uar UART number oe jJ uar 1 The character Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Application Note S19893EJ1VOANOO Appendix A UART Driver Function 57 78 Flow Chart om e uart is in 0 1 or 2 No Yes Send character EM1_UARTx_THR r Send character EM1 UARTx_THR c EN Figure A 4 Send a Character Note x is 0 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 When the character is n send r Note x is 0 1 or 2 If EM1 UARTx LSRH 5 is 1 write the r to EMQ1 UARTx THR register 3 Send the character If EM1 UARTx LSRH 5 is 1 write the character to EMQ1 UARTx THR register Application Note 819893EJ1VOA
5. Appendix A UART Driver Function 45 78 Appendix A UART Driver Function A 1 UART Driver Function List The following table shows the UART driver interface functions Table A 1 UART Driver Function List Class Function Name Function Detail em1_uart_init uart initialize em1_uart_set_config set the UART configure em1_uart_get_config get the uart configure em uart send send a character em1 uart recv receive a character em1 uart enable flw cnt enable uart hardware flow control disable uart hardware flow control mer uei emi uart por gio em uart print error em1 uart port uart initialize the uart port for flow control em uart dma enable enable UART for DMA emi_uart enable gio recv enable GIO86 for receive em uart dma disable disable UART for DMA Application Note 819893EJ1VOANOO Appendix A UART Driver Function 46 78 A 2 UART Global Variable Define The following table shows the UART global variable define Table A 2 Global Variable Define Name Type X L Pet o Z volatile uchar simulate cts is enable or not Application Note 819893EJ1VOANOO Appendix A UART Driver Function 47 78 A 3 UART Structure Define The following table shows the UART structure define Table A 3 Structure Define Structure Name struct st UART SETTING UART setting information A 3 1 st_UART_SETTING Table A 4 Structure of st UART SETTING Membr Type etal Z none 1 2 sto
6. DRV RESULT em1 uart set config struct st UART SETTING uart value Argument VO Detail structst UART SETTING 1 UART information Function Return DRV OK The function executes successfully DRV ERR PARAM The input parameter is error Application Note 819893EJ1VOANOO Appendix A UART Driver Function Flow Chart Le No e uart is in 0 1 or 2 Yes No he mode is in 0 or 1 Yes Set parity EM1 UARTx LCR 5 3 parity Set stop bit EM1 UARTx LCR 2 stop bit Set length bit EM1_UARTx_LCR 1 0 length Set divisor EM1_UARTx_LCRI 7 1b EM1 UARTx DLM DLM EM1 UARTx DLL DLL EM1 UARTx LCR 7 0b y Enable receive error EM1_UARTx_IER 0x4 Mode mode is 0 mode is 1 Disable FIFO Enable FIFO Disable flow control Enable flow control Rs Figure A 2 Set the Configure Note x is O 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error If the UART mode is not in O or 1 the input parameter is error Application Note 819893EJ1VOANOO 52 78 Appendix A UART Driver Function 53 78 2 Set the UART attribute Note x is 0 1 or 2 Set parity EM1 UARTx LCR 5 3 parity Set stop bit EM1 UARTx LCR 2 stop bit Set length bit EM1 UARTx LCR 1 0 length Set divisor E
7. Application Note 19893EJ1VOANOO Chapter 2 Usage of UART Interface 15 78 The bit length setting is as following table Table 2 3 UART Transmit Receive Bit Length Definition Bit Length Bit Bito 5 bit length O 0 0 6 bit length 0 1 7 bit length 1 0 8 bit length e Parity The bit 5 3 of EM1 UARTx LCR register control the parity of EMMA Mobilei UART About the bit definition please refer to the Chapter 3 2 5 Line control register of EMMA Mobile1 UART user s manual The parity setting is as following table Table 2 4 UART Parity Definition Parity Type Bit5 Bit Bts Nenpariy x J x 0 Odd parity EN o ee ee MEN Even parity a a Stick high fixedtot 1 0 o 1 Stick low fixed to 0 Note x don t care e Stop Bit The bit 2 of EM1 UARTx LCR register control the stop bit numbers of EMMA Mobile1 UART About the bit definition please refer to the Chapter 3 2 5 Line control register of EMMA Mobile1 UART user s manual The stop bit setting is as following table Table 2 5 UART Stop Bit Definition Stop Bit Numbers Bi2 Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 16 78 2 2 2 Automatic Flow Control with CPU or DMA The following figure shows the operation process for sending and receiving with automatic flow control Start D Set UART configure Set interrupt or error detection Y Send and Receive with CPU
8. 5 Print the receive error This process is the same to process 6 of Chapter 3 2 2 Operation Detail of this document 6 Disable flow control and FIFO The process calls the em1 uart disable flw cnt function The em1 uart disable flw cnt function finishes the following functions for UARTO e Disable RTS and CTS EM1 UARTx MCRI5 0b Disable the automatic flow control EM1 UARTx MCR 1 1b Enable RTS The process calls the em1 uart disable fifo function The emi_uart disable fifo function finishes the following functions for UARTO e Disable FIFO EM1 UARTx FCR 0 Ob Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 37 78 3 4 Example of Simulate Flow Control The hardware connection of simulate flow control is as follow figure EMMA Mobile1 PC RXDO lt TXD TXDO gt RXD GlO86 CTS GIO85 lt RTS GND GND Figure 3 6 Hardware Connection of Simulate Flow Control Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 3 4 1 Operation Flow About the UART function please refer to the Appendix A UART Driver Function lt q Initialize GIO for RTS and CTS em1 uart port gio Y Set UART configure emi uart set config Y Clear UART receive error em1 uart clear error Yes Send and Receive em1 uart gio send
9. MALS POR ataca Re de id n tes 10 Table 2 2 UART Divisor Definition coiere ein eo eet eo nu Aine Bate Pe cete etes 14 Table 2 3 UART Transmit Receive Bit Length Definition 15 Tabl 2 4 WART Parity D finition ss ento Petr ai tot ep es ehe eL eset ed ues oque meds 15 Table 2 5 UART Stop Bit Definition 15 Table A 1 JART Driver F rictlon EISE oou epo tera en apo ego acai Ea eee eee es 45 Table A 2 Global Variable Define 46 Table A 3 Structure Denn Ge uicti e enu ede este tesice e pee cose tastes deus bees OE See qat dela de us 47 Table A 4 Structure of st UART SETTING eeseeee nenne 47 LIST OF FIGURES Figure 2 1 The Overview Operation sise 9 Figure 2 2 The Function of Send and Receive ccccccceseseeeeeeeeeceeeeeeeeeeeeessaaeaeeseeeeeeaas 13 Figure 2 3 tne Data ROMA einen nine 14 Figure 2 4 The Function of Automatic Flow Control 16 Figure 2 5 The CTS Control Signal ii 19 Figure 2 6 The RTS Gontrol Signals ii toe Re bead o equ da und Once te ee 19 Figure 2 7 The Function of Simulate Flow Control 20 Figure 2 8 The Simulate CTS Control Signal 22 Figure 2 9 The Simulate RTS Control Signal 22 Figure 3 T JARTO InitlaliZatlOn seen a teer Ea e rogi ve Ve xatd a ERE retia exa eee ad a 25 Figure 3 2 Hardware Connection of Send and Receive sseeeeessesseees 28 Figure 3 3 Example of Send and Receive RR 29 Figure 3 4 Hardware Connection of Automatic Flow Control
10. DMA Y Un initialize UART x Figure 2 4 The Function of Automatic Flow Control 1 Set the configuration Set the baud rate data length parity stop bit error detection If enable flow control set the FIFO and enable flow control e Attribute setting The related registers are as follow Note x is O 1 or 2 EM1 UARTx LCR EM1 UARTx DLM EM1 UARTx DLL e FIFO setting The related registers are as follow EM1 UARTx FCR e Flow control setting The related registers are as follow EM1 UARTx HCRO0 EM1 UARTx MCR 2 Set the interrupt or error detection The related registers are as follow EM1 UARTx IER Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 17 78 SEC_ITO_IENSO INTC ITO IENO 3 Send and receive The related registers are as follow EM1 UARTx LSR EM1 UARTx THR EM1 UARTx RBR When use DMA the registers of DMA are as follow DMA M2P CONT DMA M2P PEO LCHOLCH3 INT RAW DMA M2P LCHO AADD DMA M2P LCHO AOFF DMA M2P LCHO ASIZE DMA M2P LCHO ASIZE COUNT DMA M2P LCHO BADD DMA M2P LCHO LENG DMA M2P LCHO MODE DMA P2M LCHO AADD DMA P2M LCHO BOFF DMA P2M LCHO BSIZE DMA P2M LCHO BSIZE COUNT DMA P2M LCHO BADD DMA P2M LCHO LENG DMA P2M LCHO MODE DMA M2P LCH1 AADD DMA M2P LCH1 AOFF DMA M2P LCH 1 ASIZE DMA M2P LCH1 ASIZE COUNT DMA M2P LCH1 BADD DMA M2P LCH1 LENG DMA M2P LCH1 MODE DMA P2M LCH1 AAD
11. Driver Function 67 78 A 4 11 Send a Character with Simulate Flow Control Function Name emi_uart gio send Format void em1 uart gio send uchar c Argument Parameter Type I O Detail Le char The character Function Return None Flow Chart Start gt Check enable send or not Send the character End D Figure A 10 Send a Character with Simulate Flow Control Note 1 Check CTS is enable or not f the bit 85 is high the received terminal can not receive characters f the bit 85 is low the received terminal can receive characters define UARTO CTS CHECK do if the GIO85 is low g_uart_cts 0 else g uart cts 1 while g uart cts 1 Application Note 819893EJ1VOANOO Appendix A UART Driver Function 68 78 2 Send the character em1_uart_send 0 c Remark This function only uses GIO85 for UARTO Application Note 819893EJ1VOANOO Appendix A UART Driver Function 69 78 A 4 12 Receive a Character with Simulate Flow Control Function Name emi_uart gio recv Format uchar em1_uart_gio_recv Argument None Function Return The received character Flow Chart Start gt Enable receive Y Receive character Y Disable receive 4 End 3 Figure A 11 Received a Character with Simulate Flow Control Note 1 Enable receive characters Set
12. Start D e uart is in 0 1 or 27 Yes Flow Chart Disable DMA send and receive EM1 UARTx HCRO 1 0 00b Ro Figure A 15 Disable UART DMA Note x is 0 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error Application Note 819893EJ1VOANOO ANNEX Modification History 78 78 ANNEX Modification History Modification Contents Author Dae New version Aug 4 2009 Ver 1 00 Application Note S19893EJ1VOANOO
13. e uart is in 0 1 or 2 Yes Flow Chart Read receive error c EM1 UARTx LSR Y Print receive error Rs Figure A 13 Print the Receive Error Note x is 0 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 Read the receive error Note x is O 1 or 2 Read the receive error from EM1 UARTx LSR 3 Print the error information Application Note 819893EJ1VOANOO Appendix A UART Driver Function 72 78 A 4 15 Print the Configure Function Name em1_uart_print_configure Format void em1 uart print configure struct st UART SETTING uart value Argument Parameter Type I O Detail struct st_UART_SETTING 1 UART Information Function Return None Flow Chart None Note None Application Note S19893EJ1VOANOO Appendix A UART Driver Function 73 78 A 4 16 Initialize Port for Flow Control Function Name em1 uart port uart Format void em1 uart port uart void Argument None Function Return None Flow Chart None Note None Application Note 819893EJ1VOANOO Appendix A UART Driver Function 74 78 A 4 17 Enable GIO for Receive Function Name emi_uart_enable_gio_recv Format void em1_uart_enable_gio_recv void Argument None Function Return None Flow Chart None Note Output low level from GIO86 Applic
14. em1 uart gio recv Enable receive em1 uart enable gio recv v Print UART receive error em1_uart_print_error A Figure 3 7 Example of Simulate Flow Control Application Note 819893EJ1VOANOO 38 78 Chapter 3 Example of UART Operation 39 78 3 4 2 Operation Detail 1 Initialize the GIO85 and GIO86 The process calls the em1_uart_port_gio function The em1_uart_port_gio function finishes the following functions for UARTO Change the URTO RTSB to GIO P86 Set the GIO P86 output mode Set the GIO P86 output high level Change the URTO CTSB to GIO P85 Set the GIO P85 input mode Enable the GIO P85 input 2 Set the UART configure This process is the same to process 1 of Chapter 3 2 2 Operation Detail of this document 3 Clear the receive error This process is the same to process 4 of Chapter 3 2 2 Operation Detail of this document 4 UART send and receive The process calls the em1 uart gio recv function The em1 uart gio recv function finishes the following functions for UARTO Output low level from GIO86 Check whether receive a character Head the received character Output high level from GIO86 The process calls the em1 uart gio send function The em1 uart gio send function finishes the following functions for UARTO Check if GIO85 is high or low Check if there is a space for a character
15. ey Ae Figure 2 6 The RTS Control Signal The FIFO is hardware to send and receive characters automatically When the number of data in the receive FIFO reaches the trigger level the RTSZ pin is set to the high level transmit stop request When the data in the receive FIFO is read it becomes empty or has less data than the trigger level the RTSZ pin is set to the low level transmit request Application Note S19893EJ1VOANOO Chapter 2 Usage of UART Interface 20 78 2 2 3 Simulate Flow Control The following figure shows the operation process for sending and receiving with simulate flow control Start gt Set UART configure Y Set interrupt or error detection Y Initialize GIO for simulate flow control y Send and Receive Y x Figure 2 7 The Function of Simulate Flow Control 1 Set the configuration Set the baud rate data length parity stop bit error detection and disable the flow control The related registers are as follow Note x is O 1 or 2 EM1 UARTx LCR EM1 UARTx DLM EM1 UARTx DLL 2 Set the interrupt or error detection The related registers are as follow EM1 UARTx IER SEC ITO IENSO INTC ITO IENO 3 Initialize the GIO for simulate flow control In this document only use GIO85 for CTS and GIO86 for RTS The related registers are as follow CHG PINSEL G80 GIO E1 HH GIO EO HH CHG PULL G80 Application Note 819893E
16. nid animent dencre a demand anni 58 A 4 6 Enable the Flow Control iii 59 Application Note 819893EJ1VOANOO INDEX 5 78 AA T Disable te FION GORI Ol d iuit irae od ats ae eria tar stab a ats 61 A49 Enable PIE ooa totem Debsmfw eta uo etia hi erac eum fers v a ou nga a bia re qu et false 62 AAS Disable FIFO e E 65 A 4 10 Initialize GIO for Simulate Flow Control ss 66 A 4 11 Send a Character with Simulate Flow Control 67 A 4 12 Receive a Character with Simulate Flow Control ccccccccceseeeeeeeeeeseeeeeeeeeeeeeeeas 69 A 4 13 Clear the Receive Ertl ssicctccevvscciasvenwodslscasate px ERR ERR da EG ACC E n savers CE Ra E Fa a i 70 A414 FIP ING RECEIVES EO ues etsohs ri uote cv eren Nu rpren ane ons Ewa ci A 71 Ped Io Prin the GOMMQUNC Es imis ce Da Roten tutu os E s er de aie ent 72 A 4 16 Initialize Port for Flow Control sise 73 A4 d Enable Io 10r RECCIVE ssa dotis Rae een ads nn en ee nae 74 A419 Enable VART DMA dan titane da AA ida Etwa aen i eaa tct 75 A 4 19 Disable UART DMA cccccccccseesccceeeseneceeeceeeesceeeeeeeeeeeeeeeseeeeeeaaeseeeeeeaaeseeeeeeaaseeeeeas 77 ANNEX Modification HIStory iiie us sana tua p RR un teen na cra vicecteeceutanatiecectsonsneausawanesUunsieaashdeuncuatiandeaties 78 Application Note 819893EJ1VOANOO INDEX 6 78 LIST OF TABLES Table 1 1 Hardware Environment tetsnnnnestihebesemeteebenlenten 8 Table 1 2 Software Environment ss 8 Table 2 L AN
17. receive characters with automatic flow control How to send and receive characters with simulate flow control How to send and receive characters with DMA The UART block incorporated in EMMA Mobile1 has two 64 byte FIFO buffers one for transmission and one for reception About the details of functions please refer to CHAPTER 1 OVERVIEW of EMMA Mobile1 UART user s manual 1 2 Development Environment e Hardware environment of this project is listed as below Table 1 1 Hardware Environment Nam Version Maker EMMA Mobile1 evaluation board PSKCH2Y NEC Electronics S 0016 01 PARTNER Jet ICE ARM Kyoto Microcomputer Co Ltd e Software used in this project is listed as below Table 1 2 Software Environment GNUARM Toolchain V4 3 2 GNU WJETSET ARM V5 10a Kyoto Microcomputer Co Ltd Application Note S19893EJ1VOANOO Chapter 2 Usage of UART Interface 9 78 Chapter 2 Usage of UART Interface 2 1 Overview Procedure of UART Operation The following picture is the overview operation process for UART 4 Start 5 Initialize UART Y Set configure Y Set interrupt or error detection Y Send and receive Y Un initialize UART Y E Figure 2 1 The Overview Operation 1 Initialize the UART Open the clock The related registers are as follow ASMU GCLKCTRL2ENA ASMU GCLKCTRL2 ASMU_DIVU70SCLK ASMU_DIVU71SCLK ASMU_DI
18. the port 86 low to enable the terminal send data 2 Receive a character c em1_uart_recv 0 3 Disable receive characters Set the port 86 high to disable the terminal send data Remark This function only uses GIO86 for UARTO Application Note S19893EJ1VOANOO Appendix A UART Driver Function 70 78 A 4 13 Clear the Receive Error Function Name em1_uart_clear_error Format DRV_RESULT em1 uart clear error uchar num Argument Parameter Type I O Detail Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Start D e uart is in 0 1 or 27 Yes Flow Chart Clear receive error c EM1 UARTx LSR Ro Figure A 12 Clear the Receive Error Note x is 0 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 Clear the receive error Note x is O 1 or 2 Read the EM1 UARTx LSR to clear the receive error Application Note 819893EJ1VOANOO Appendix A UART Driver Function 71 78 A 4 14 Print the Receive Error Function Name em1_uart_print_error Format DRV_RESULT em1_uart_print_error uchar num Argument Parameter Type I O Detail Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error DRV_ERR_ABNORMAL There is at least one error in receive process Start gt
19. to URTO CTSB e Change the GIO P86 to URTO RTSB e Enable the URTO CTSB input About the details please refer to the ASMU GIO user s manual and 1 chip user s manual 2 Set the UART configure The process calls the em1 uart set config function The em1 uart set config function finishes the following functions for UARTO e Set parity EM1 UARTO LCR 5 3 000b none parity e Set stop bit EM1 UARTO LCR 2 Ob 1 stop bit e Set length EM1 UARTO LCRHR 1 0 11b 8 bits e Set divisor EM1_UARTO_LCR 7 1b EM1 UARTO DLM 0 EM1 UARTO DLL 0x7C 115200 bps EM1 UARTO LCHR 7 Ob Enable receive error EM1 UARTO IER 0x4 e Enable FIFO EM1 UARTO FCRHR 2 1b Reset the transfer buffer of FIFO EM1 UARTO FCRHR 1 1b Reset the receive buffer of FIFO EM1 UARTO FCHR 5 0b Set 16 bytes FIFO mode EM1 UARTO FCR 7 6 00b The trigger number is 1 EM1 UARTO FCRIO 1b Enable FIFO Enable RTS and CTS EM1 UARTO HCRO 6 Ob Set RTS mode O Application Note S19893EJ1VOANOO Chapter 3 Example of UART Operation 36 78 EM1 UARTO MCR 5 1b Enable the automatic flow control EM1 UARTO MCR 1 1b Enable RTS 3 Clear the receive error This process is the same to process 4 of Chapter 3 2 2 Operation Detail of this document 4 UART send and receive This process is the same to process 5 of Chapter 3 2 2 Operation Detail of this document
20. 1 byte EM1 UARTO HCHRO 5 1b e Enable DMA receive EM1 UARTO HCRO 1 1b 6 Enable secure interrupt of DMA SEC ITO IENS1 5 1 7 Check receive over If DMA P2M PEO LCHOLCHS INT RAWI 4 is 1 receive over 8 Enable DMA send About the details please refer to the EMMA Mobile1 DMA user s manual Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 44 78 9 Enable UARTO send The process calls the em1_uart_dma_enable function The em1_uart_dma_enable function finishes the following functions for UARTO e DMA send modeO and DMA receive modeO EM1 UARTO HCRO 2 Ob EM1 UARTO HCRHRO S Ob EM1 UARTO FCRI 3 Ob e Exclude timeout EM1 UARTO HCRO 4 1b Access 1 byte EM1 UARTO HCRHRO 5 1b e Enable DMA send EM1 UARTO HCRO 0 1b 10 Check receive over If DMA M2P PEO LCHOLCH3 INT RAWT 4 is 1 receive over 11 Print the receive error This process is the same to process 6 of Chapter 3 2 2 Operation Detail of this document 12 Disable UARTO DMA flow control and FIFO To disable UARTO DMA call the em1 uart dma disable function The emi_uart dma disable function finishes the following functions for UARTO e Disable DMA send and receive EM1 UARTO HCRO 1 0 00b About how to disable flow control and FIFO please refer to the process 6 of Chapter 3 3 2 Operation Detail of this document Application Note 819893EJ1VOANOO
21. 8 3 Set the 16 bytes or 64 bytes FIFO mode f the trigger number is 1 4 8 or 14 set 16 bytes FIFO mode EM1 UARTx FCR 5 Ob f the trigger number is 32 or 56 bytes FIFO mode EM1 UARTx FCR 5 1b 4 Set trigger number EM1 UARTx FCR 7 6 trigger number 5 Enable FIFO EM1 UARTx FCR 0 1b Application Note 819893EJ1VOANOO Appendix A UART Driver Function 65 78 A 4 9 Disable FIFO Function Name em1_uart_disable_fifo Format DRV_RESULT em1 uart disable fifo uchar num Argument Parameter Type I O Detail Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Start D e uart is in 0 1 or 27 Yes Flow Chart Disable FIFO EM1 UARTx FCR 0 0b Ro Figure A 9 Disable FIFO Note x is 0 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 Disable FIFO Note x is 0 1 or 2 EM1 UARTx FCR O0 Ob Application Note 819893EJ1VOANOO Appendix A UART Driver Function 66 78 A 4 10 Initialize GIO for Simulate Flow Control Function Name em1_uart_port_gio Format DRV_RESULT em1_uart_port_gio void Argument None Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Flow Chart None Application Note S19893EJ1VOANOO Appendix A UART
22. 8 e Get length bit length EM1 UARTO LCR 1 0 e Get divisor DLM EM1_UARTO_ DLM DLL EM1 UARTO DLL e Get flow control mode EM1 UARTO MCR IS 3 Print UART configure Print the information of baud rate bit numbers parity stop bit and flow control And this function is used for giving more information about the related UART 4 Clear the receive error The process calls the em1 uart clear error function The em1 uart clear error function finishes the following functions for UARTO e Read LSR register to clear error information Error EM1 UARTO LSR 5 UART send and receive The process calls the em1_uart_recv function The em1 uart recv function finishes the following functions for UARTO Check receive finish If EM1 UARTO LSR 0 is 1 receive finish e Read the received character Data EM1 UARTO RBR The process calls the em1_uart_ send function The emi_uart_ send function finishes the following functions for UARTO Check send ready If EM1 UARTO LSR 5 is 1 send ready e Write the character to be sent EM1 UARTO THR data Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 32 78 6 Print the receive error The process calls the em1_uart_print_error function The em1_uart_print_error function finishes the following functions for UARTO e Read the receive error Error EM1 UARTO LSR Application Note
23. 819893EJ1VOANOO Chapter 3 Example of UART Operation 33 78 3 3 Example of Automatic Flow Control The hardware connection of automatic flow control is as follow figure EMMA Mobile1 PC RXDO lt TXD TXDO gt RXD RTSO gt CTS CTSO lt RTS GND 4 GND Figure 3 4 Hardware Connection of Automatic Flow Control Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 3 3 1 Operation Flow d Start D If uart number is 0 Yes Initialize port for UARTO em1 uart port uart Y Set UART configure em1 uart set config y Clear UART receive error em1_uart_clear_error Send amp Receive over Yes Send and Receive em1_uart_send em1_uart_recv v Print UART receive error em1_uart_print_error y Disable flow control em1 uart disable flw cnt Disable the FIFO em1 uart disable fifo Y AS Figure 3 5 Example of Automatic Flow Control About the UART function please refer to the Appendix A UART Driver Function Application Note 19893EJ1VOANOO 34 78 Chapter 3 Example of UART Operation 35 78 3 3 2 Operation Detail 1 Initialize the port for UARTO The process calls the em1_uart_port_uart function The em1 uart port uart function finishes the following functions for UARTO e Change the GIO P85
24. D DMA P2M LCH1 BOFF DMA P2M LCH 1 BSIZE DMA P2M LCH1 BSIZE COUNT DMA P2M LCH1 BADD DMA P2M LCH1 LENG Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 18 78 DMA P2M LCH1 MODE DMA M2P LCH2 AADD DMA M2P LCH2 AOFF DMA M2P LCH2 ASIZE DMA M2P LCH2 ASIZE COUNT DMA M2P LCH2 BADD DMA M2P LCH2 LENG DMA M2P LCH2 MODE DMA P2M LCH2 AADD DMA P2M LCH2 BOFF DMA P2M LCH2 BSIZE DMA P2M LCH2 BSIZE COUNT DMA P2M LCH2 BADD DMA P2M LCH2 LENG DMA P2M LCH2 MODE About how to use DMA please refer to the EMMA Mobile1 DMA user s manual 4 Un initialize the UART Un initialization only disables FIFO and flow control e FIFO setting The related registers are as follow EM1 UARTx FCR e Flow control setting The related registers are as follow EM1 UARTx HCRO EM1 UARTx MCR Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 19 78 The setting of baud rate bit numbers parity and stop bit is the same to Chapter 2 2 1 Send and Receive of this document so about the details please refer to that chapter e CTS control signal CTS N Figure 2 5 The CTS Control Signal When the CTS pin is set to the low level transmit request data in the transmit buffer is transmitted When the CTS pin changes from the low level to the high level during data transmission data being transmitted is transmitted fully and transmit of the next data is stopped e RTS control signal RST
25. ER SEC ITO IENSO INTC ITO IENO 3 Send and receive The related registers are as follow EM1 UARTx LSR EM1 UARTx THR EM1 UARTx RBR Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 14 78 e Data Format The UART transmit receive format is as following figure 16 cycles DATA Ly GMM GLEE A BE A De A ce asa ABE A Br y PAWN Figure 2 3 The Data Format After one start bit 5 8 data bits then one optional parity bit At last one or two stop bit e Baud rate The EM1 UARTx DLM register and EM1 UARTx DLL register control the divisor of EMMA Mobile1 UART About the bit definition please refer to the Chapter 3 2 10 Divisor latch LS byte register and Chapter 3 2 11 Divisor latch MS byte register of EMMA Mobile1 UART user s manual The formula of divisor is as follow Divisor set value reference clock frequency Hz requested baud rate bps x 16 The reference clock frequency is PLL3 If it is 229 376MHz the DLM and DLL setting values are as following table Table 2 2 UART Divisor Definition 0x00AB 600 0x05D Ox0055 0x00AB About the divisor setting please refer to the Chapter 5 2 Baud Rate Setting of EMMA Mobile1 UART user s manual e Bit Length The bit 1 0 of EM1_UARTx_LCR register control the transmit receive bit length of EMMA Mobile1 UART About the bit definition please refer to the Chapter 3 2 5 Line control register of EMMA Mobile1 UART user s manual
26. J1VOANOO Chapter 2 Usage of UART Interface 21 78 4 Send and receive The related registers are as follow EM1 UARTx_LSR EM1 UARTx THR EM1 UARTx RBR Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 22 78 The setting of baud rate bit numbers parity and stop bit is the same to Chapter 2 2 1 Send and Receive of this document so about the details please refer to that chapter e GlO85 simulates CTS control signal GIO85 N Figure 2 8 The Simulate CTS Control Signal When the GIO85 pin is set to the low level transmit request data can be transmitted When the GIO85 pin changes from the low level to the high level during data transmission data being transmitted is transmitted fully and transmit of the next data is stopped e GlO86 simulates RTS control signal GIO86 N Figure 2 9 The Simulate RTS Control Signal When the EMMA Mobile can receive characters the GIO86 pin is set to the low level transmit request When the EMMA Mobile1 can not receive characters the GIOS86 pin is set to the high level transmit stop request Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 23 78 2 2 4 Modem About the Modem please refer to the Chapter 2 2 2 Automatic Flow Control of this document And there is no example about this setting in the chapter 3 2 2 5 IrDA About the IrDA please refer to the Chapter 2 2 2 Automatic Flow Control of this document And there
27. M1 UARTx LCR T 1b EM1 UARTx DLM DLM EM1 UARTx DLL DLL EM1 UARTx LCR T 0b Enable the UART receive error EM1 UARTx IER 0x4 About how to set the parity stop bit length and divisor please refer to the Chapter 3 REGISTERS of EMMA Mobile1 UART user s manual 3 Set the FIFO and flow control If the mode is O disable FIFO and the automatic flow control If the model is 1 enable FIFO and the automatic flow control Application Note 819893EJ1VOANOO Appendix A UART Driver Function A 4 3 Get the Configure Function Name em uart get config Format DRV RESULT em1 uart get config struct st UART SETTING p uart value Argument struct st UART SETTING Function Return DRV OK The function executes successfully DRV ERR PARAM The input parameter is error Flow Chart Note x is 0 1 or 2 Note Start e uart is in O 1 or 2 Yes 0 Get parity parity EM1_UARTx_LCR 5 3 Get stop bit stop bit EM1_UARTx_LCR 2 Get length bit length EM1 UARTx LCR 1 0 Get divisor DLM EM1 UARTx DLM DLL EM1 UARTx DLL Get flow control mode mode EM1_UARTx_MCRI 5 Y EN Figure A 3 Get the Configure 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error Application Note 819893EJ1VOANOO 54 78 UART information Appendix A UART Driver Function 55 78
28. NOO Appendix A UART Driver Function 58 78 A 4 5 Receive a Character Function Name em1 uart recv Format uchar em1 uart recv uchar num Argument VO Detail mum uar UART number Function Return DRV ERR PARAM The input parameter is error Other The received character Flow Chart Get character c EM1_UARTx_RBR EN Figure A 5 Receive a Character Note x is O 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 Receive the character Note x is O 1 or 2 If EM1 UARTx LSRHR 0 is 1 get the character from EM1 UARTx RBR register Application Note 819893EJ1VOANOO Appendix A UART Driver Function 59 78 A 4 6 Enable the Flow Control Function Name em1 uart enable flw cnt Format DRV RESULT em1 uart enable flw cnt struct st UART SETTING uart value Argument Parameter Type 1 0 Detail struct st_UART_SETTING UART Information Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Start 2 e uart is in O 1 or 2 Yes Flow Chart Set auto RTS mode EM1 UARTx HCRO 6 0b Set automatic flow control EM1_UARTx_MCRI 5 1b Enable RTS EM1 UARTx MCR 1 1b Y Rs Figure A 6 Enable Flow Control Note x is 0 1 or 2 Note 1 Che
29. To our customers Old Company Name in Catalogs and Other Documents On April 1 2010 NEC Electronics Corporation merged with Renesas Technology Corporation and Renesas Electronics Corporation took over all the business of both companies Therefore although the old company name remains in this document it is a valid Renesas Electronics document We appreciate your understanding Renesas Electronics website http www renesas com April 1 2010 Renesas Electronics Corporation Issued by Renesas Electronics Corporation http www renesas com Send any inquiries to http www renesas com inquiry 24 NE S AS 8 10 11 12 Notice All information included in this document is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas Electronics products listed herein please confirm the latest product information with a Renesas Electronics sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is gr
30. VU72SCLK Application Note S19893EJ1VOANOO Chapter 2 Usage of UART Interface 10 78 e Reset the UART The related registers are as follow ASMU_RESETREQOENA ASMU_RESETCTRLO Port setting The related registers are as follow For port setting CHG PINSEL G80 CHG PINSEL G96 For input attribute setting CHG PULLO CHG PULL G80 CHG PULL G104 For driver capability setting CHG DRIVE2 For wait control and read mode ASMU AB1 U70WAITCTRL ASMU AB1 U7Z1WAITCTRL ASMU AB1 U72WAITCTRL ASMU AB1 U7OREADCTRL ASMU_AB1_U71READCTRL ASMU_AB1_U72READCTRL e Disable UART interrupt The related registers are as follow SEC ITO IDSSO INTC ITO IDSO About the details please refer to the Appendix A 4 1 Initialize of this document For port setting the following table is the alternate port table Table 2 1 Alternate Port PortName Function Function2 Function3 URTO CTSB GIO P85 URTO CTSB E URTO RTSB GIO P86 URTO RTSB URT1 SOUT URT2 SRIN NAND ALE Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 11 78 2 Set the configuration e Attribute setting The related registers are as follow Note x is O 1 or 2 EM1 UARTx LCR EM1 UARTx DLM EM1 UARTx DLL e FIFO setting The related registers are as follow EM1 UARTx FCR e Flow control setting The related registers are as follow EM1 UARTx HCRO EM1 UARTx MCR 3 Set the interrupt or error detection The related regi
31. _clear_error Yes i Print UART receive error em1 uart print error Enable DMA receive I Y Disable UARTO DMA Enable UARTO receive emt uart dma disable Disable flow control em1 uart disable flw cnt i Disable the FIFO em1 uart disable fifo Y x Figure 3 8 Example of Automatic Flow Control with DMA em1 uart dma enable Enable secure interrupt of DMA About the UART function please refer to the Appendix A UART Driver Function Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 43 78 3 5 2 Operation Detail 1 Initialize the port for UARTO This process is the same to process 1 of Chapter 3 3 2 Operation Detail of this document 2 Set the UART configure This process is the same to process 2 of Chapter 3 3 2 Operation Detail of this document 3 Clear the receive error This process is the same to process 4 of Chapter 3 2 2 Operation Detail of this document 4 Enable DMA receive About the details please refer to the EMMA Mobile1 DMA user s manual 5 Enable UARTO receive The process calls the em1_uart_dma_enable function The em1_uart_dma_enable function finishes the following functions for UARTO e DMAsend modeO and DMA receive modeO EM1 UARTO HCRHRO 2 Ob EM1 UARTO HCHRO S Ob EM1 UARTO FCHR S 0b e Exclude timeout EM1 UARTO HCHRO 4 1b Access
32. ain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronic
33. anted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information When exporting the products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations Renesas Electronics has used reasonable care in preparing the information included in this document b
34. ation Note 819893EJ1VOANOO Appendix A UART Driver Function 75 78 A 4 18 Enable UART DMA Function Name em uart dma enable Format DRV RESULT em1 uart dma enable uchar num uchar send recv Argument Parameter Type Detail es w UART number send recv uchar MEME send and receive Function Return DRV OK The function executes successfully DRV ERR PARAM The input parameter is error Start gt e uart is in 0 1 or 2 Yes Flow Chart Set DMA modeO EM1 UARTx HCRO0 3 2 00b EM1 UARTx FCR 3 0b v Exclude timeout EM1_UARTx_HCRO 4 1b Y Set DMA access 1 byte EM1 UARTx HCRO 5 0b Y Enable DMA send and receive EM1 UARTx HCRO 1 0 11b Rs Figure A 14 Enable UART DMA Application Note 19893EJ1VOANOO Appendix A UART Driver Function 76 78 Note x is O 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error Application Note 819893EJ1VOANOO Appendix A UART Driver Function 77 78 A 4 19 Disable UART DMA Function Name em uart dma disable Format DRV RESULT em1 uart dma disable uchar num uchar send recv Argument Parameter Type Detail es w UART number send recv uchar MEME send and receive Function Return DRV OK The function executes successfully DRV ERR PARAM The input parameter is error
35. ck the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 Set the RTS mode Note x is O 1 or 2 Set RTS mode O If use RTS mode 1 set 1 to EM1 UARTO HCRO 6 EM1 UARTO HCRO 6 Ob Application Note 819893EJ1VOANOO Appendix A UART Driver Function 60 78 About the difference between mode 0 and model please refer to the Chapter 3 2 12 Hardware control register of EMMA Mobile1 UART user s manual 3 Enable automatic RTS and CTS Enable the automatic flow control EM1 UARTx MCR 5 1b Enable RTS EM1 UARTx MCR 1 1b Application Note 819893EJ1VOANOO Appendix A UART Driver Function 61 78 A 4 7 Disable the Flow Control Function Name em1 uart disable flw cnt Format DRV RESULT em1 uart disable flw cnt uchar num Argument Parameter Type 1 0 Detail Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Q Start D e uart is in 0 1 or 2 Yes Flow Chart Disable automatic flow control EM1 UARTx MCRI5 0b Enable RTS EM1 UARTx MCR 1 1b Y Rs Figure A 7 Disable Flow Control Note x is 0 1 or 2 Note 1 Check the input parameter If the UART number is not in O 1 or 2 the input parameter is error 2 Disable automatic RTS and CTS Note x is 0 1 or 2 Disable the automatic flow control EM1 UARTx MCR 5 0b
36. de ASMU AB1 U7OREADCTRL 0 Set wait control ASMU_AB1_U71WAITCTRL OxF1FOF Set read mode ASMU_AB1_U71READCTRL 0 Y Disable global interrupt SEC ITO IDSSO 9 1b INTC ITO IDSO 9 1b Disable global interrupt SEC ITO IDSSO 10 1b INTC ITO IDSO 10 1b Chang port to U72 CHG PINSEL G96 25 24 01b CHG PINSEL G96 27 26 01b CHG PINSEL G96 29 28 01b CHG PINSEL G96 31 30 01b Y Enable input and disable pull CHG PULL G104 26 24 111b CHG PULL G104 18 16 1115 Y Set driver capability 4mA CHG_DRIVE2 9 8 01b Y Set wait control ASMU AB1 U72WAITCTRL OxF1FOF Set read mode ASMU AB1 U72READCTRL 0 Y Disable global interrupt SEC ITO IDSSO 11 1b INTC ITO IDSO 11 1b 2 Application Note S19893EJ1VOANOO EN Figure A 1 UART Initialize Appendix A UART Driver Function 50 78 Note 1 Open the clock The related registers are as follow ASMU GCLKCTRL2ENA ASMU GCLKCTRL2 2 Reset and reset release setting The related registers are as follow ASMU RESETREQOENA ASMU RESETCTRLO 3 Set divisor The related registers are as follow ASMU_DIVU70SCLK ASMU_DIVU71SCLK ASMU_DIVU72SCLK Application Note S19893EJ1VOANOO Appendix A UART Driver Function 51 78 A 4 2 Set the Configure Function Name em1 uart set config Format
37. dge that possibility of defects thereof cannot be eliminated entirely To minimize risks of damage to property or injury including death to persons arising from defects in NEC Electronics products customers must incorporate sufficient safety measures in their design such as redundancy fire containment and anti failure features Note Js NEC Electronics as used in this document means NEC Electronics Corporation and also includes its majority owned subsidiaries NEC Electronics products means any product developed or manufactured by or for NEC Electronics as defined above All trademarks or registered trademarks are the property of their respective owners Registered trademarks and trademarks are not noted in this document Application Note 819893EJ1VOANOO INDEX 4 78 CONTENTS Chapter IntroducllOli xai io Xs ERE e te ciate cde ica ne voa Pao Cevb aus ae vta a ous natation sous 8 OUTRE m 8 12 Development ERVIFOnmiDm DIE cess vta eee aee d uera Deve m demie el ina ans slai pro ado cx avs 8 Chapter 2 Usage of UART Interface sine noi miettes sentent es tua ron ce sse Devo eaae 9 2 1 Overview Procedure of UART Operation sise 9 2 2 Detail Procedure of UART Operation sisi 12 2 21 Send ard BHecelv8 ss dessen b te etos de Mutua Gee 13 2 2 2 Automatic Flow Control with CPU or DMA RL 16 2 2 3 Simulate Flow Control iii 20 2 2 4 WOE scores ete ee es RU N
38. e Write the character to be send About the GIO details please refer to the ASMU GIO user s manual and 1 chip user s manual About the UART details please refer to the process 5 of Chapter 3 2 2 Operation Detail o this document Application Note S19893EJ1VOANOO Chapter 3 Example of UART Operation 40 78 5 Enable receive The process calls the em1_uart_enable_gio_recv function The em1_uart_enable_gio_recv function finishes the following functions for UARTO Output low level from GIO86 About the details please refer to the EMMA Mobile1 ASMU GIO user s manual and 1 chip user s manual 6 Print the receive error This process is the same to process 6 of Chapter 3 2 2 Operation Detail of this document Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 41 78 3 5 Example of Automatic Flow Control with DMA About the hardware connection of automatic flow control please refer to figure3 4 Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 42 78 3 5 1 Operation Flow om 4 N If uart number is 0 Yes Yes Enable DMA send Initialize port for UARTO i em1 uart port uart i Enable UARTO send em1 uart dma enable N Set UART configure em1 uart set config r Clear UART receive error em1_uart
39. is no example about this setting in the chapter 3 Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 24 78 Chapter 3 Example of UART Operation The following contents show 4 examples how to send and receive how to enable automatic flow control how to use GIO to simulate flow control and how to use DMA to transmission About the API details please refer to the Appendix A UART Driver Function Application Note S19893EJ1VOANOO Chapter 3 Example of UART Operation 25 78 3 1 Initialization 3 1 1 Operation Flow Start D Y Initialize UARTO em1 eva uart init NN Figure 3 1 UARTO Initialization About the UART function please refer to the Appendix A UART Driver Function Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 3 1 2 Operation Detail 1 Initialize the UARTO The process calls the em1_uart_init 26 78 The em1 uart init finishes the following functions for UART Open U70 CLK ASMU GCLKCTRL2ENA 5 1b ASMU_GCLKCTRL2 5 1b ASMU GCLKCTRL2ENA 5 Ob Open U70_SCLK ASMU GCLKCTRL2ENA 6 1b ASMU_GCLKCTRL2 6 1b ASMU GCLKCTRL2ENA 6 Ob e Reset UARTO ASMU RESETREQOENA 7 1b ASMU_RESETREQO 27 0b ASMU RESETREQOENA 7 0b e Reset release UARTO ASMU RESETREQOENA 27 1b ASMU_RESETREQ0O 27 1b ASMU RESETREQOENA 27 0b e Set divisor ASMU_DIVU70SCLK Divisor Divisor is a
40. n input value about how to set the divisor please refers to the Chapter 3 2 52 U70 SCLK frequency division setting register of EMMA Mobile1 ASMU GIO user s manual e Switch port function CHG PINSEL G80 11 10 01b CHG PINSEL G80 13 12 01b e Enable input and disable pull up down CHG PULLO0 30 28 111b CHG PULL G80 22 20 111b e Set the driver capability CHG DRIVE2 5 4 01b GIO P85 gt URTO CTSB GIO P86 gt URTO RTSB For URTO SRIN For URTO CTS 4mA Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 27 78 e Set the wait control and read mode ASMU AB1 U70WAITCTRL OxF1FOF ASMU AB1 U7OREADCTRL 0 e Disable the UART global interrupt SEC ITO IDSSO 9 1b INTC ITO IDSO 9 1b Application Note 819893EJ1VOANOO Chapter 3 Example of UART Operation 3 2 Example of Send and Receive The hardware connection of send and receive is as follow figure EMMA Mobile1 RXDO TXDO GND lt PC TXD RXD GND Figure 3 2 Hardware Connection of Send and Receive Application Note S19893EJ1VOANOO 28 78 Chapter 3 Example of UART Operation 29 78 3 2 1 Operation Flow D Set UART configure em1 uart set config y Get UART configure em1_uart_get_config Y Print UART configure em1 uart print configure i Clear UART receive error em1 uart clear error Yes
41. p bit automatic flow control or not FIFO triger number uart_parity none odd even stick high stick low Application Note S19893EJ1VOANOO Appendix A UART Driver Function 48 78 A 4 UART Driver Function Detail A 4 1 Initialize Function Name em1_uart_init Format DRV_RESULT em1 uart init uchar num Argument VO Detail num uchar UART number 0 1 or 2 Function Return DRV_OK The function executes successfully DRV_ERR_PARAM The input parameter is error Application Note S19893EJ1VOANOO Appendix A UART Driver Function Flow Chart 49 78 UARTO Open the U70_CLK and U70 SCLK Reset U70 Reset release U70 Set divisor Open the U70 CLK and U71 SCLK Reset U71 Reset release U71 Set divisor Y Y Chang port to U70 CHG PINSEL G80 11 10 01b CHG PINSEL G80 13 12 01b Chang port to U71 CHG PINSEL G80 11 10 10b CHG PINSEL G80 13 12 10b UART2 Open the U70 CLK and U72 SCLK Reset U72 Reset release U72 Set divisor Y Enable input and disable pull CHG_PULLO 30 28 111b CHG PULL G80 22 20 111b Enable input and disable pull CHG PULL G80 22 20 111b y Y Set driver capability 4mA CHG_DRIVE2 5 4 01b Set driver capability 4mA CHG_DRIVE2 7 6 01b Y Y Set wait control ASMU AB1 U70WAITCTRL OxF1FOF Set read mo
42. quipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems medical equipment or systems for life support e g artificial life support devices or systems surgical implantations or healthcare intervention e g excision etc and any other applications or purposes that pose a direct threat to human life You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under cert
43. r ANR sr Nan 23 PUN ON TES 23 Chapter 3 Example of UART Operation ss saines aere Evae c Va as aou aed 24 S Mai Z US RTL Tm Eom 25 SEE Soie 9 el fm RM m EP 25 gk Operation D tails ne nn Mt me A tse N ees tev er 26 3 2 Example of Send and RECEIVE auci tectis tenir ae sno esstetucti usns ape du festis o6 oi ade ce aide 28 32 i 912 241 6 0 al es m ER M mem 29 322 Oe lal BI Mem 30 3 9 Example of Automatic Flow Controle ana aee ua a eei e Boa nci E ecd ogue 33 SODOMIE ner EOD E 34 9 92 012 21 gg B Fz mec tan ne Re ete een ee em eT 35 3 4 Example of Simulate Flow Control 37 Sm Pa ie 912 241 6 1 el PE S UT ene 38 S142 Operallom Detalles RE 39 3 5 Example of Automatic Flow Control with DMA RL 41 Seema i 912 On FOW E mmm 42 93 9 2 Ope lallOmiDetally sev tL 43 Appendix A UART Driver FuncllOli uei aea nee die na a rasan ec cuan ra uan av cusa Marea ues 45 WEE SM Suede iE 45 A 2 UART Global Variable Define 46 AS UART SUCUS Delle aot bar aede ttd esa canna aa i evasit oval es eap at imu ue aad 47 AG SL ART SETTING en aka iig asusta tiens cuf o fada ta tumba ima nasus 47 A 4 UART Driver Function Detail iii 48 SP NS MAW ZS acs eatin att T T T 48 A42 Seb Ile CONGUE Essen ete nest ee ci eius 51 A 4 3 Get the Configure LL nenne nennen nennen nnn nnnn nnn n nnn nsns nna n nn resa n anna 54 AAA Senda Saec e C 56 A45 Receive a GHANA OM seu
44. s products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics 434 N S AS Application Note Multimedia Processor for Mobile Applications UART Interface EMMA Mobile1 Document No S19893EJ1VOANOO Date Published AUG 2009 NEC Electronics Corporation 2009 Printed in Japan PREFACE PREFACE Purpose The purpose of this document is to specify the usage of the UART interface Organization This document includes the following e Introduction e Usage of UART Interface e Example of UART Operation e UART Driver Function Notation Here explains the meaning of following words in text Note Explanation of item indicated in the text Caution Information to which user should afford special attention Remark Supplementary information Related document The following tables list related documents Reference Document Document Name Version date Description MU GI S19265EJ1VOUM00_ ASMUGIO pdf NECEL ne S19268EJ1VOUMOO 1chip pdf 1 Chip User s Manual S19262EJ1V0UMOO UART pdf UART User s Manual S19255EJ1 VOUMO0 DMA PDF DMA User s Manual S19907EJ1VOANO0_GD pdf GD Spec Application Note 19893EJ1VOANOO PREFACE Disclaimers The information contained in this documen
45. sters are as follow EM1 UARTx IER SEC ITO IENSO INTC ITO IENO 4 Send and receive The related registers are as follow EM1 UARTx LSR EM1 UARTx THR EM1 UARTx RBR 5 Un initialize the UART e FIFO setting The related registers are as follow EM1 UARTx FCR e Flow control setting The related registers are as follow EM1 UARTx HCRO0 EM1 UARTx MCR Application Note 819893EJ1VOANOO Chapter 2 Usage of UART Interface 12 78 2 2 Detail Procedure of UART Operation According to the hardware feature the UART can have the following function Note the above process does not have initialization About the initialization please refer to the Chapter 2 1 Overview Procedure of UART Operation of this document Application Note S19893EJ1VOANOO Chapter 2 Usage of UART Interface 13 78 2 2 1 Send and Receive The following figure shows the operation process for sending and receiving without flow control 1 Start gt Set UART configure Y Set interrupt or error detection Y Send and Receive AS Figure 2 2 The Function of Send and Receive 1 Set the configuration Set the baud rate data length parity stop bit error detection and disable the flow control The related registers are as follow Note x is 0 1 or 2 EM1 UARTx LCR EM1 UARTx DLM EM1 UARTx DLL 2 Set the interrupt or error detection The related registers are as follow EM1 UARTx I
46. t is subject to change without prior notice in the future Refer to the latest applicable data sheet s and user s manual when designing a product for mass production No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Electronics NEC Electronics assumes no responsibility for any errors that may appear in this document NEC Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of NEC Electronics products listed in this documents or any other liability arising from the use of such products No license express implied or otherwise is granted under any patents copyrights or other intellectual property rights of NEC Electronics or others Descriptions of circuits software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples The incorporation of these circuits software and information in the design of a customers equipment shall be done under the full responsibility of the customer NEC Electronics assume no responsibility for any losses incurred by customers or third parties arising from the use of these circuits software and information While NEC Electronics endeavors to enhance the quality reliability and safety of NEC Electronics products customers agree and acknowle
47. ut Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein Renesas Electronics products are classified according to the following three quality grades Standard High Quality and Specific The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application categorized as Specific without the prior written consent of Renesas Electronics Further you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics The quality grade of each Renesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers office e
Download Pdf Manuals
Related Search
Related Contents
NetGuardian V16/M16 G2 TEJT C 2002 07 QIAsymphony® DNA Handbook ix-1100Ⅴ ix H33/HB4丿 載ーナー ロ 製品寸法 ロ 取付け必要スペース Appendix II: The Consumer Direction Module Table of Contents Il Sistema RFC ASUS A8H User's Manual Peerless PS-1 flat panel wall mount Copyright © All rights reserved.
Failed to retrieve file