1864 views|0 replies

3836

Posts

19

Resources
The OP
 

Configuration and use of TI C2000 TMS320F28379D SCID SCIB [Copy link]

This post was last edited by fish001 on 2019-8-7 22:43

TI's official routines only give the configuration of SCIA and not the configuration methods of other SCIs. In fact, the configurations of these are the same. The following takes the configuration of SCIB and SCID as an example and explains the configuration process in combination with the data sheet: As for why some parameters should be configured as in the program, please refer to the technical manual of F28379 and the screenshots at the end of the blog (of course, they are all screenshots in the technical manual)

Note: The red part in the program represents the part that needs attention, and the other colors correspond to the function implementation methods of the same color below

/*****************System configuration********************/
InitSysCtrl(); // Initialize the system

InitGpio(); // Initialize GPIO

SciIOCfg(); // Initialize SCI pins

/*Interrupt configuration*/
DINT; //Turn off all interrupts
InitPieCtrl(); //Initialize PIE control registers to their default states. By default all PIEs are cleared
//Disable all CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable(); //Initialize the PIE vector table with a pointer to the shell interrupt service routine (ISR).

/*Interrupt vector configuration*/
EALLOW;
PieVectTable.SCIB_RX_INT = &scibRxFifoIsr; //Serial port B receive interrupt
PieVectTable.SCID_RX_INT = &scidRxFifoIsr; //Serial port D receive interrupt

EDIS;

/*SCI with FIFO receive interrupt*/
scib_fifo_init(); //Initialize SCI_B's FIFO
scid_fifo_init(); //Initialize SCI_D's FIFO

PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block

PieCtrlRegs.PIEIER9.bit.INTx3 = 1; // PIE Group 9, INT3, configure sciB receive interrupt enable*/
PieCtrlRegs.PIEIER8.bit.INTx7 = 1; // PIE Group 8, INT7, configure sciD receive interrupt enable*/

IER |= M_INT9|M_INT8; // Enable CPU INT
EINT; // Enable global interrupt INTM

The following is a detailed explanation of the configuration process based on the above code:

The first is the configuration program of the SCI initialization function:

1.SciIOCfg();

void SciIOCfg(void)
{
/*SCIB: configure GPIO for pull-up and multiplexing functions*/ //Note that the multiplexing of the port pins here needs to find the multiplexing mode of the GPIO Muxed Pins port multiplexing pins in the data table. SCIB is 2
//RX--P19
GPIO_SetupPinMux(19, GPIO_MUX_CPU1, 2);
GPIO_SetupPinOptions(19, GPIO_INPUT, GPIO_PULLUP); //This should be GPIO_PULLUP ->1. The routine is wrong. The original routine is GPIO_PUSHPULL ->0. The correct one should be GPIO_PULLUP to enable pull-up
//TX--18
GPIO_SetupPinMux(18, GPIO_MUX_CPU1, 2);
GPIO_SetupPinOptions(18, GPIO_OUTPUT, GPIO_ASYNC);

/*SCID: Configure GPIO for pull-up and multiplexing functions*/ //Note that the multiplexing of the port pins here needs to find the multiplexing mode of the GPIO Muxed Pins port multiplexing pins in the data table. SCID is 6
//RX--P105
GPIO_SetupPinMux(105, GPIO_MUX_CPU1, 6);
GPIO_SetupPinOptions(105, GPIO_INPUT, GPIO_PULLUP);
//TX--104
GPIO_SetupPinMux(104, GPIO_MUX_CPU1, 6);
GPIO_SetupPinOptions(104, GPIO_OUTPUT, GPIO_ASYNC);

}

FIFO initialization function: scib_fifo_init(); (Of course, SCID only needs to change scib in the program to scid. SCID is not described here)

void scib_fifo_init(void)
{
ScibRegs.SCICCR.all = 0x0007; // One stop bit without loopback
// No parity bit, 8 character bits,
// async (idle line) mode, idle line protocol
ScibRegs.SCICTL1.all = 0x0003; // Enable TX, RX, internal SCICLK (SCI clock),
// Disable RX ERR, SLEEP, TXWAKE
// Baud rate high and low bits
ScibRegs.SCIHBAUD.all = 0x0000;
ScibRegs.SCILBAUD.all = SCI_PRD; // Configure baud rate to SCI_PRD

ScibRegs.SCIFFTX.all = 0xE040; // Enable SCI FIFO function, reset SCI, send reset

ScibRegs.SCIFFRX.bit.RXFFIENA = 1; // Enable SCI FIFO transmit function
ScibRegs.SCIFFRX.bit.RXFFIL = RXNUM; // Set the number of received bits to RXNUM 0h-10h
ScibRegs.SCIFFRX.bit.RXFFINTCLR = 1; // Clear FIFO count interrupt flag

ScibRegs.SCIFFCT.all = 0x00;

ScibRegs.SCICTL1.all = 0x0023; // Restart sci
ScibRegs.SCIFFRX.bit.RXFIFORESET = 1; // Restart sci receive fifo
}

As for the baud rate configuration, you need to refer to the official routine. Note: The clock is 200 MHz for correct calculation. You can find the calculation method in the technical manual! The official SCI routine also calculates this way.

//Baud rate calculation method
#define CPU_FREQ 200E6
#define LSPCLK_FREQ CPU_FREQ/4
#define SCI_FREQ 115200
#define SCI_PRD (LSPCLK_FREQ/(SCI_FREQ*8))-1

Figure :

1. Pin multiplexing

2. Interrupt channel mapping:

This post is from DSP and ARM Processors
 

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