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.

Compiler/TMS320C28346: TMS320C28346 can't receive data from arduino via SCI-A

Part Number: TMS320C28346
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE, TMS320F28069

Tool/software: TI C/C++ Compiler

Hi..

this time I want to send data from Arduino to TMSC28346ZFET via SCI-A. Then the data is processed then TMSC28346ZFET sends it to SERVO DRIVER via SCI-B. But, the data can't even be sent from Arduino to IT. And there is no pin 29 on the control card where the pin is the TX pin from SCI-A so I replace it with pin 27. Actually I am confused because the data I sent cannot appear on the IT monitor serial port (COM 6). I also adjusted the baud rate to each other but it didn't work.

If anyone knows the problem, please help.

Regards,

Amirullah S.

  • Hi Amirullah,

    I'm sorry, I do not understand your system from your description.

    In general, I would recommend making the system simple to start with and only then begin to increase complexity. 

    I would recommend starting with the sci_echoback example from C2000Ware/controlSUITE and see if you can get to work as designed.  This example will create communication working between a C2000 & a PC running a terminal application.  Here you can use SCIA with GPIO28 & GPIO29. 

    Once you get that working, it should be relatively easy to start migrating the code to communicate with the Arduino (or the SERVO driver system).  In increasing the system complexity, you'll also need to make sure the hardware connections & any translator/transceiver needs are met.


    Thank you,
    Brett

  • Thank you for your reply. actually i already start with sci_echoback with another control card/board (TMS320F28069) and it was going well. The data that i send from arduino sent to the control card and sent it back to arduino. It works like what i need. We know that this TMS320F8609 only have 1 channel SCI, so because of that i use another control card which  has more than one SCI channel (SCI-A, SCI-B and also SCI-C) and it is TMS320C28346ZFET. I already configure all of the system of control card with my program, but what is happening is the serial port(monitor) of this control card can't show the data that i send. i don't know it sent or not, but i see the program can be debugged. The indicator of the board also light up (maybe it's the sign that program is sent). My goal is to control the motor stepper using servo driver. I send data from arduino through SCI-A and the TI (control card TMS320C28346ZFET) sent the data to SERVO DRIVER through SCI-B. I think that the big problem is about the configuration of this control card. i already read the data sheet and etc but it still same. when i run the program i got this problem but i don't know what is it. please check this picture down below.

    Regards,

    Amirullah S.

  • Hi Amirullah,

    Thanks for the enhanced description.

    First, be aware that the F28069 has two SCI peripherals (SCI-A & SCI-B).  So if the only reason you're upgrading is the need to have more than 1 SCI port, you might reconsider.

    ===

    Note that the C28346 won't be able to directly use code generated for a device in the F2806x family.  There should be a fair amount of knowledge you'll be able to reuse, but I'd restart the code. 
    (the C2834x has no internal flash, no internal ADC, etc.  As a result there will be changes in the system initialization & it will be better to just take from C2834x example code)

    I'd recommend starting with the C2834x's sci_echoback & seeing if you can get that to work.  Have you tried this yet?  Once you get that working I'd then rebuild what you want to do from that - which shouldn't be too hard. 


    Thank you,
    Brett

  • Thank u again.

    I already use C2834X sci_echoback. And it still not working.

    // TI File $Revision: /main/3 $
    // Checkin $Date: June 28, 2010   09:18:50 $
    //###########################################################################
    //
    // FILE:    Example_2834xSci_Echoback.c
    //
    // TITLE:   DSP2834x Device SCI Echoback.
    //
    // ASSUMPTIONS:
    //
    //    This program requires the DSP2834x header files.
    //    As supplied, this project is configured for "boot to SARAM" operation.
    //
    //    Connect the SCI-A port to a PC via a transciever and cable.
    //    The PC application 'hypterterminal' can be used to view the data
    //    from the SCI and to send information to the SCI.  Characters recieved
    //    by the SCI port are sent back to the host.
    //
    //    As supplied, this project is configured for "boot to SARAM"
    //    operation.  The 2834x Boot Mode table is shown below.
    //    For information on configuring the boot mode of an eZdsp,
    //    please refer to the documentation included with the eZdsp,
    //
    //       $Boot_Table:
    //
    //         GPIO87   GPIO86     GPIO85   GPIO84
    //          XA15     XA14       XA13     XA12
    //           PU       PU         PU       PU
    //        ==========================================
    //            1        1          1        1    TI Test Only
    //            1        1          1        0    SCI-A boot
    //            1        1          0        1    SPI-A boot
    //            1        1          0        0    I2C-A boot timing 1
    //            1        0          1        1    eCAN-A boot timing 1
    //            1        0          1        0    McBSP-A boot
    //            1        0          0        1    Jump to XINTF x16
    //            1        0          0        0    Jump to XINTF x32
    //            0        1          1        1    eCAN-A boot timing 2
    //            0        1          1        0    Parallel GPIO I/O boot
    //            0        1          0        1    Parallel XINTF boot
    //            0        1          0        0    Jump to SARAM       <- "boot to SARAM"
    //            0        0          1        1    Branch to check boot mode
    //            0        0          1        0    I2C-A boot timing 2
    //            0        0          0        1    Reserved
    //            0        0          0        0    TI Test Only
    //                                              Boot_Table_End$$
    //
    // DESCRIPTION:
    //
    //
    //    This test recieves and echo-backs data through the SCI-A port.
    //
    //    1) Configure hyperterminal:
    //       Use the included hyperterminal configuration file SCI_96.ht.
    //       To load this configuration in hyperterminal: file->open
    //       and then select the SCI_96.ht file.
    //    2) Check the COM port.
    //       The configuration file is currently setup for COM1.
    //       If this is not correct, disconnect Call->Disconnect
    //       Open the File-Properties dialog and select the correct COM port.
    //    3) Connect hyperterminal Call->Call
    //       and then start the 2834x SCI echoback program execution.
    //    4) The program will print out a greeting and then ask you to
    //       enter a character which it will echo back to hyperterminal.
    //
    //    As is, the program configures SCI-A for 9600 baud with
    //    SYSCLKOUT = 300MHz and LSPCLK = 75.0 MHz
    //    SYSCLKOUT = 250MHz and LSPCLK = 62.5 Mhz
    //    SYSCLKOUT = 200MHz and LSPCLK = 50.0 Mhz
    
    //
    //    Watch Variables:
    //       LoopCount for the number of characters sent
    //       ErrorCount
    //
    //
    //###########################################################################
    // $TI Release: 2834x Header Files V1.12 $
    // $Release Date: March 2011 $
    //###########################################################################
    
    #include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
    
    // Prototype statements for functions found within this file.
    void scia_echoback_init(void);
    void scia_fifo_init(void);
    void scia_xmit(int a);
    void scia_msg(char *msg);
    void Scia_gpio(void);
    
    // Global counts used in this example
    Uint16 LoopCount;
    Uint16 ErrorCount;
    
    void main(void)
    {
    
        Uint16 ReceivedChar;
        char *msg;
    
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the DSP2834x_SysCtrl.c file.
       InitSysCtrl();
    
    // Step 2. Initalize GPIO:
    // This example function is found in the DSP2834x_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
       // InitGpio(); Skipped for this example
    
    // For this example, only init the pins for the SCI-A port.
    // This function is found in the DSP2834x_Sci.c file.
       InitSciaGpio();
    
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
       DINT;
    
    // Initialize PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the DSP2834x_PieCtrl.c file.
       InitPieCtrl();
    
    // Disable CPU interrupts and clear all CPU interrupt flags:
       IER = 0x0000;
       IFR = 0x0000;
    
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    // This will populate the entire table, even if the interrupt
    // is not used in this example.  This is useful for debug purposes.
    // The shell ISR routines are found in DSP2834x_DefaultIsr.c.
    // This function is found in DSP2834x_PieVect.c.
       InitPieVectTable();
    
    // Step 4. Initialize all the Device Peripherals:
    // This function is found in DSP2834x_InitPeripherals.c
    // InitPeripherals(); // Not required for this example
    
    // Step 5. User specific code:
    
        LoopCount = 0;
        ErrorCount = 0;
    
        scia_fifo_init();      // Initialize the SCI FIFO
        scia_echoback_init();  // Initalize SCI for echoback
    
       // msg = "\r\n\n\nHello World!\0";
       // scia_msg(msg);
    
       // msg = "\r\nYou will enter a character, and the DSP will echo it back! \n\0";
       // scia_msg(msg);
    
        for(;;)
        {
         //  msg = "\r\nEnter a character: \0";
          // scia_msg(msg);
    
           // Wait for inc character
           while(SciaRegs.SCIFFRX.bit.RXFFST == 0) { } // wait for XRDY =1 for empty state
    
           // Get character
           ReceivedChar = SciaRegs.SCIRXBUF.all;
    
           // Echo character back
           //msg = "  You sent: \0";
           //scia_msg(msg);
           scia_xmit(ReceivedChar);
    
           LoopCount++;
        }
    
    }
    
    
    // Test 1,SCIA  DLB, 8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity
    void scia_echoback_init()
    {
        // Note: Clocks were turned on to the SCIA peripheral
        // in the InitSysCtrl() function
    
        SciaRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback
                                       // No parity,8 char bits,
                                       // async mode, idle-line protocol
        SciaRegs.SCICTL1.all =0x0003;  // enable TX, RX, internal SCICLK,
                                       // Disable RX ERR, SLEEP, TXWAKE
        SciaRegs.SCICTL2.all =0x0003;
        SciaRegs.SCICTL2.bit.TXINTENA =1;
        SciaRegs.SCICTL2.bit.RXBKINTENA =1;
        #if (CPU_FRQ_300MHZ)
              SciaRegs.SCIHBAUD    =0x0003;  // 9600 baud @LSPCLK = 75.0MHz.
              SciaRegs.SCILBAUD    =0x00D0;
        #endif
        #if (CPU_FRQ_250MHZ)
              SciaRegs.SCIHBAUD    =0x0003;  // 9600 baud @LSPCLK = 62.5MHz.
              SciaRegs.SCILBAUD    =0x002D;
        #endif
        #if (CPU_FRQ_200MHZ)
              SciaRegs.SCIHBAUD    =0x0002;  // 9600 baud @LSPCLK = 50.0MHz.
              SciaRegs.SCILBAUD    =0x008B;
        #endif
        SciaRegs.SCICTL1.all =0x0023;  // Relinquish SCI from Reset
    }
    
    // Transmit a character from the SCI
    void scia_xmit(int a)
    {
        while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
        SciaRegs.SCITXBUF=a;
    
    }
    
    void scia_msg(char * msg)
    {
        int i;
        i = 0;
        while(msg[i] != '\0')
        {
            scia_xmit(msg[i]);
            i++;
        }
    }
    
    // Initalize the SCI FIFO
    void scia_fifo_init()
    {
        SciaRegs.SCIFFTX.all=0xE040;
        SciaRegs.SCIFFRX.all=0x2044;
        SciaRegs.SCIFFCT.all=0x0;
    
    }
    
    
    
    
    
    
    //===========================================================================
    // No more.
    //===========================================================================
    
    

  • And when i debug my program using C2834x it was not running as usual. 

    I got this messege from the system. It's about compiler (maybe). When I use F2806x the running sign will be green. but when i use C28346x it's not green. i must activate the 'connect target' to make it run. Maybe that's the reason why my program is not working or maybe the problem is about configuration. I already upload my main c program and also all the problem messeges. I know you have much experiences about TI and i hope i can fond my solution from this forum.

    regards,
    Amirullah S.

  • Amirullah,

    I did a file compare of the file you sent against the controlSUITE file and notice that you made a number of changes, including commenting out code. Please use our controlSUITE files and try to get it working before making any changes. Also, make sure that you are using the proper CCS Target Configuration file for the device you are running.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken