1871 views|0 replies

6547

Posts

0

Resources
The OP
 

TMS320F28379D User Experience SCI [Copy link]

1. Introduction to SCI SCI (Serial Communication Interface) means "serial communication interface", which is a general term for serial communication technology relative to parallel communication. It was first proposed by Motorola. It is a universal asynchronous communication interface UART, which is basically the same as the asynchronous communication function of MCS-51. (The above content comes from Baidu) 2. Introduction to the SCI module of 28379D 2.1 The module function is basically UART, and the data format is programmable. The SCI of 28398D is basically the same as other 28 series products, with two enhanced functions. One is the send and receive buffer, FIFO. If the send FIFO is enabled, the bytes to be sent can be stored in the send FIFO first, and then sent out together after the number of bytes in the send FIFO reaches the set upper limit. If the receive FIFO is enabled, the received bytes can be stored in the receive FIFO first, and then an interrupt is generated to process the received data after the number of bytes in the receive FIFO reaches the set upper limit. The other is the baud rate automatic detection function, which is generally not used. 2.2 SCI module pins of 28379D 28379D has 4 SCIs, namely SCIA, SCIB, SCIC, and SCID. Each SCI has many sending pins and receiving pins, as shown in the following table: III. SCI configuration steps 3.1 Configure GPIO Configure the corresponding GPIO as the multiplexed pin of SCIx. 3.2 Configure the data format of SCI Configure the data format for sending and receiving, generally: 1 stop bit, no parity check, no loopback, idle line mode (communication between two objects, if there are three or more, the address line mode must be used), 8 data bits. 3.3 Configure the baud rate Configure the baud rate, no more words. 3.4 Configure FIFO First, you have to enable FIFO, and then configure it according to your needs. For example, enable the receive FIFO interrupt and set the number of FIFO levels. These are the basics. You can also configure some settings for baud rate self-test, but they are generally not used. 3.5 Enable SCI Reset some flags, such as SWRESET of SCICTL1 register, which must be set to 1, etc. 3.6 Configure PIE First enable PIE, then modify the PIE vector table, and then enable the corresponding PIE and CPU interrupt. 4. Code Example The example uses SCIB, and the pin uses GPIO18 as Tx and GPIO19 as Rx. 4.1 Configure GPIO EALLOW; GpioCtrlRegs.GPAPUD.bit.GPIO18=0; //Turn on the pull-up resistor GpioCtrlRegs.GPAPUD.bit.GPIO19=0; //Turn on the pull-up resistor GpioCtrlRegs.GPADIR.bit.GPIO19=0; GpioCtrlRegs.GPADIR.bit.GPIO18=1; GpioCtrlRegs.GPAGMUX2.bit.GPIO18=0; GpioCtrlRegs.GPAGMUX2.bit.GPIO19=0; GpioCtrlRegs.GPAMUX2.bit.GPIO18=2; //Multiplexed as the output of SCIB GpioCtrlRegs.GPAMUX2.bit.GPIO19=2; //Multiplexed as the input EDIS of SCIB; 4.2 Configure the data format ScibRegs.SCICCR.all = 0x0007; //1 4.3 Configure Baud Rate ScibRegs.SCIHBAUD.bit.BAUD = 0x0000; // Baud rate 115200 ScibRegs.SCILBAUD.bit.BAUD = 0x0036; // Baud rate 115200 4.4 Configure FIFO ScibRegs.SCIFFTX.bit.SCIFFENA = 1; // Enable FIFO ScibRegs.SCIFFRX.bit.RXFFIENA = 1; // Enable FIFO receive interrupt ScibRegs.SCIFFRX.bit.RXFFIL = 1; // FIFO receive byte 1 ScibRegs.SCIFFCT.all = 0x0; 4.5 Re-enable SCI ScibRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset Restart sci 4.6 Configure PIE PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable PIE EALLOW; PieVectTable.SCIB_RX_INT=&ScibInterrupt; // Modify interrupt vector table EDIS; PieCtrlRegs.PIEIER9.bit.INTx3 = 1; // Enable PIE interrupt IER |= M_INT9; // Enable CPU interrupt 4.7 Receive interrupt function ScibInterrupt is as follows: interrupt void ScibInterrupt(void) { int i=0,data; for(i=0;i
TMS320F28379D User Experience SCI


This post is from Microcontroller MCU
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list