This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28379D: SCI fifo issue.

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE, TMDSCNCD28379D

Tool/software: Code Composer Studio

I want to implement a 16 words FIFO with interrupt fro RX and TX,

I am using this code;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#define CPU_FREQ        200E6
#define LSPCLK_FREQ     CPU_FREQ/4  /* Default value at reset */
#define SCI_FREQ        115200
#define SCI_PRD         ((LSPCLK_FREQ/(SCI_FREQ*8))-1)
EALLOW;
   SciaRegs.SCICCR.all = 0x0007;      // 1 stop bit,  No loopback
                                      // No parity,8 char bits,
                                      // async mode, idle-line protocol
   /* Enable TX, RX, internal SCICLK */
   SciaRegs.SCICTL1.all = 0x0003;
                                      // Disable RX ERR, SLEEP, TXWAKE
   SciaRegs.SCICTL2.bit.TXINTENA = 1;
   SciaRegs.SCICTL2.bit.RXBKINTENA = 1;
   SciaRegs.SCIHBAUD.all = ((uint16_t)SCI_PRD  & 0xFF00U) >> 8U;
   SciaRegs.SCILBAUD.all = (uint16_t)SCI_PRD  & 0x00FFU;
   /* FIFO configuration for Transmission
    * Set the maximum level for the FIFO interrupt */
   SciaRegs.SCIFFTX.bit.TXFFIL = 0x10;
   /* Enable the interrupt for FIFO */
   SciaRegs.SCIFFTX.bit.SCIFFENA = 1;
   /* Send when FIFO is full */
   SciaRegs.SCIFFTX.bit.TXFFST = 0x10;
   /* Clear flag */
   SciaRegs.SCIFFTX.bit.TXFFINTCLR = 1;
   /* Reset SCI */
   SciaRegs.SCIFFTX.bit.SCIRST = 1;
   /* FIFO configuration for Reception
    * Set the maximum level for the FIFO interrupt */
   SciaRegs.SCIFFRX.bit.RXFFIL = 0x10;
   /* Enable RX interrupt */
   SciaRegs.SCIFFRX.bit.RXFFIENA = 1;
   /* Clear RX interrupt flag */
   SciaRegs.SCIFFRX.bit.RXFFINTCLR = 1;
   SciaRegs.SCIFFCT.all = 0x00;
   SciaRegs.SCICTL1.all = 0x0023;     // Relinquish SCI from Reset
   SciaRegs.SCIFFTX.bit.TXFIFORESET = 1;
   SciaRegs.SCIFFRX.bit.RXFIFORESET = 1;
   EDIS;

I am sending a 16 words from a terminal from my pc, the issue is the reception interrupt don't came. Does something wrong with my C code?

Thank you in advance,

Regards,

S.Tarik

  • Hi,

    Not sure if you have done other configurations like the Pinmux,etc? 

    Did SCI reception work for you with some other configuration? 

    Please look at the example in C2000Ware

    <c2kware>\device_support\f2837xd\examples\cpu1\sci_echoback\cpu01\sci_echoback. 

    It contains the configuration similar to what you are trying. 

    Regards,

    Sudharsanan 

  • yes I am configuring the pinout for SCI and I'am starting from the TI example, I ll already run a communication interface on my board, but this time I want to use the FIFO configuration.

        /* TX pin configuration */
        GPIO_SetupPinMux(28, GPIO_MUX_CPU1, 1);
        GPIO_SetupPinOptions(28, GPIO_INPUT, GPIO_PUSHPULL);
    
        /* RX pin configuration */
        GPIO_SetupPinMux(29, GPIO_MUX_CPU1, 1);
        GPIO_SetupPinOptions(29, GPIO_OUTPUT, GPIO_ASYNC);
    
    
        /***********************Interrupt linking functions*****************************/
        EALLOW;
    
        /* Interrupt for RX interrupt service routine */
        PieVectTable.SCIA_RX_INT = &sciaRxFifoIsr;
    
        /* Interrupt for TX interrupt service routine */
        PieVectTable.SCIA_TX_INT = &sciaTxFifoIsr;
    
        EDIS;
        /************************Peripheral Initialization*****************************/
        /* Enable interrupts required for this example */
    
        /* Enable the PIE block */
        PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
    
        /* PIE Group 9, INT1 */
        PieCtrlRegs.PIEIER9.bit.INTx1 = 1;
    
        /* PIE Group 9, INT2 */
        PieCtrlRegs.PIEIER9.bit.INTx2 = 1;
    
        /* Enable CPU INT */
        IER = M_INT9;
    
        EINT;
    

  • Hi, 

    What is the value of HBAUD and LBAUD. The CPU Frequency is defined as 200E6?

    Regards,

    Sudharsanan

  • The CPU frequency is 200Mhz,

    And the frequency i want to set is 115200.

    The HBAUD and LBAUD, is defined by this equation #define SCI_PRD         ((LSPCLK_FREQ/(SCI_FREQ*8))-1)

       SciaRegs.SCIHBAUD.all = ((uint16_t)SCI_PRD  & 0xFF00U) >> 8U;
       SciaRegs.SCILBAUD.all = (uint16_t)SCI_PRD  & 0x00FFU;

  • Yes. But you have 

    #define CPU_FREQ        200E6
    #define LSPCLK_FREQ     CPU_FREQ/4  /* Default value at reset */
    why is CPU_FREQ 200E6 if it is hex should it not be in 0x. Also 200Mhz should be 200000000 in decimal right?
    In our example calculation
    CPU_FREQ 200000000
    LSPCLK_FREQ 50000000
    BRR = 50000000/(9600*8)
    which gives 651 or 0x28B in Hex as used in example.
    In your calculation 200E6/115200 doesn't look correct? please check that part.
    Regards,
    Sudharsanan
  • Dear TI Hello,

    I resolved my issue,

    The correct pinout for the launch-xl is this, 43 for RX and 42 for TX

        /* TX pin configuration */
        GPIO_SetupPinMux(43, GPIO_MUX_CPU1, 15);
        GPIO_SetupPinOptions(43, GPIO_INPUT, GPIO_PUSHPULL);
    
        /* RX pin configuration */
        GPIO_SetupPinMux(42, GPIO_MUX_CPU1, 15);
        GPIO_SetupPinOptions(42, GPIO_OUTPUT, GPIO_ASYNC);

    It is not the same as the TMDSCNCD28379D, the pin out changes from device to another

    Thank you for help,

  • Hi,

    Good to know that you got it working and thanks for posting the resolution too.

    Regards,

    Sudharsanan

  • This is the TI example I am using, 

    C:\ti\c2000\C2000Ware_3_01_00_00\device_support\f2837xd\examples\cpu1\sci_loopback_interrupts\cpu01\Example_2837xDSci_FFDLB_int.c

    //
    // Included Files
    //
    #include "F28x_Project.h"
    
    //
    // Defines
    //
    #define CPU_FREQ        60E6
    #define LSPCLK_FREQ     CPU_FREQ/4
    #define SCI_FREQ        100E3
    #define SCI_PRD         ((LSPCLK_FREQ/(SCI_FREQ*8))-1)
    
    //
    // Globals
    //
    Uint16 sdataA[2];    // Send data for SCI-A
    Uint16 rdataA[2];    // Received data for SCI-A
    Uint16 rdata_pointA; // Used for checking the received data
    
    //
    // Function Prototypes
    //
    interrupt void sciaTxFifoIsr(void);
    interrupt void sciaRxFifoIsr(void);
    void scia_fifo_init(void);
    void error(void);
    

    Hexadecimal is just a representation,

    Since, Uint16 is represented in memory with binary, if you execute this operation (uint16_t)SCI_PRD  & 0xFF00U,

    It will mask the 8 LSB bits, and i guess memory don't care about format since the result is in 0s and 1s

  • Hi,

    We don't typically do it that way, if it is hexadecimal we always prefix with a 0x. For this case 

    if #define CPU_FREQ 60E6 is used it does not appear right in my CCS view(as 0x60E6)  only if I use 0x60E6. it appears properly in my CCS expression/memory view. 

    Regards,

    Sudharsanan