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.

Bidirectional communication between PC and experimenter kit TMS320F28335

Other Parts Discussed in Thread: TMDSDOCK28335, TMS320F28335, MAX3221

 

Hello TI-community,

 

I'm a beginner in DSP programming and need your help for solving my problem.

At first I want to describe my hardware and software setting.

 

Hardware

I use an experimenter board (TMDSDOCK28335). It consists of a docking station and a controlCard F28335. The complete docking station is powered by USB by a PC.

 

The manual can be found here.

http://www.ti.com/lit/zip/sprc675

 

In file "USBDockingStation_Schematic [R3].pdf" you can find the circuit diagram of the docking station.

 

A low resolution figure of the schematic of the docking station can be found here.

http://e2e.ti.com/cfs-filesystemfile.ashx/__key/CommunityServer.Discussions.Components.Files/35/0574.XDS100_5F00_USBDockingStation.png

 

Attention!

I change the docking station hardware. The connection jumper J9 is closed now.

 

Software

For the DSP F28335 I use Code Composer Studio 3.3. I found an example code for SCI communication and I changed it for solving my problem.

On the PC I write a test application in Microsoft Visual Studio 2005.

 

What do I want?

The docking station has got a FTDI chip. This chip (FT2232D) has a connection to the DSP F28335. The circuit diagram can be seen in the schematic of the docking station. The red rectangle symbolizes the FTDI FT2232D. The FTDI has got two channels. ChannelA is for programming the DSP via JTAG. ChannelB is connected to GPIO28 and GPIO29 of the DSP. These two ports belong to SCI-A interface of the DSP.

I want a bidirectional communication between my PC and the DSP F28335 by using the SCI-A interface. My test application for the PC uses a DLL for the FTDI chip. My Code Composer Code project activates the SCI-A, but I have a problem with the Interrupt Service Routine of SCIRX-A. Therefore I use an oscilloscope to plot the electrical signal on the ports GPO28 and GPIO29. The Interrupt Service Routine for SCITX-A works fine. The communication from the DSP to the PC works perfectly, but the signals from the PC to the DSP were not executed.

The following picture shows the electrical signal on port GPIO28 (blue graph) and GPIO29 (orange graph).

GPIO28 and GPIO29


The electrical signal never becomes Boolean false! I cannot explain that. Therefore I remove my jumper at J9 and I measure the output signal of the FTDI. The following picture shows the output signal of the FTDI2232D.

output signal og the FTDI

It works fine.

 

My problem

I want to control the DSP with my PC test application, but the signals of the PC are not executed by the DSP. I think the error has to do with DSP port GPIO28 (SCIRX-A) because its signal never becomes Boolean false. The voltage never becomes 0V, so the interrupt SCIRX-A never occur.

My first idea was to disable the internal pull up for GPIO28. I add command

                GpioCtrlRegs.GPAPUD.bit.GPIO28 = 1;

but it does not work.

 

What is wrong with my hardware?

Is there any mistake in my CCS project? Wrong setting of the GPIO's? Wrong initial sequence of the ports?

 

Please help me. Thanks in advance!

Steffen

 

Here my CCS project:

// Original by
//      Lab9_2: TMS320F28335
//      (c) Frank Bormann
//
//            DSP sends the string "The 28335-UART is fine !"   every 2 seconds
//            CPU Timer0 ISR every 50 ms
//            SCI-Setup: 9600 Baud, 8 Bit , ODD Parity , 1 Stopbit   
//            SCI - TX - Interrupt used in this Lab
//            Watchdog active , serviced in ISR and main-loop
//###########################################################################
#include "DSP2833x_Device.h"

// External Function prototypes
extern void InitSysCtrl(void);
extern void InitPieCtrl(void);
extern void InitPieVectTable(void);
extern void InitCpuTimers(void);
extern void ConfigCpuTimer(struct CPUTIMER_VARS *, float, float);

// Prototype statements for functions found within this file.
void Gpio_select(void);
void SCIA_init(void);
interrupt void cpu_timer0_isr(void); // Prototype for Timer 0 Interrupt Service Routine
interrupt void SCIA_TX_isr(void);     // SCI-A Transmit Interrupt Service

//SL
interrupt void SCIA_RX_isr(void);

// Global Variables
char message[]={"The F28335 - UART ISR is fine ! # "};
int index =0;            // index variable into message

//###########################################################################
//                        main code                                   
//###########################################################################
void main(void)
{
    InitSysCtrl();    // Basic Core Initialization
                    // SYSCLK=150MHz, HISPCLK=75MHz, LSPCLK=37.5MHz
    EALLOW;
       SysCtrlRegs.WDCR= 0x00AF;          // Re-enable the watchdog
       EDIS;            // 0x00E8  to disable the Watchdog , Prescaler = 1
                       // 0x00AF  to NOT disable the Watchdog, Prescaler = 64
   
    Gpio_select();    // GPIO9, GPIO11, GPIO34 and GPIO49 as output
                    // to 4 LEDs at Peripheral Explorer   
   
    InitPieCtrl();        // default status of PIE; in DSP2833x_PieCtrl.c
   
    InitPieVectTable(); // init PIE vector table; in DSP2833x_PieVect.c
   
    // re-map PIE - entry for Timer 0 Interrupt and SCI-A-TX
    EALLOW; 
       PieVectTable.TINT0 = &cpu_timer0_isr;
    PieVectTable.SCITXINTA = &SCIA_TX_isr;

    //SL
    PieVectTable.SCIRXINTA=&SCIA_RX_isr;

       EDIS;   
          
    InitCpuTimers();    // Function in: DSP2833x_CpuTimers.c   
   
    // Configure CPU-Timer 0 to interrupt every 50 ms:
    // 150MHz CPU Freq, 50000 µseconds interrupt period
    ConfigCpuTimer(&CpuTimer0, 150, 50000);    // DSP2833x_CpuTimers.c
   
       SCIA_init();  // Initalize SCI
  
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;    // Cpu Timer 0 isr
    PieCtrlRegs.PIEIER9.bit.INTx2 = 1;  // SCI-A-TX-isr

    //SL
    PieCtrlRegs.PIEIER9.bit.INTx1=1;
    // Enable the PIE.
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;


    // Enable CPU INT1 (CPU-Timer 0) and INT9 (SCIA-TX):
    IER = 0x101;
   
    // Enable global Interrupts and higher priority real-time debug events:
       EINT;   // Enable Global interrupt INTM
       ERTM;   // Enable Global realtime interrupt DBGM
      
       CpuTimer0Regs.TCR.bit.TSS = 0;        // Start T0

    while(1)
    {   
          SciaRegs.SCITXBUF=message[index++];            // send first character
                  
           while(CpuTimer0.InterruptCount < 40)      // 40 * 50ms = 2 sec
           {
            EALLOW;
            SysCtrlRegs.WDKEY = 0xAA;            // Service watchdog #2
            EDIS;
        }
        index =0;
        CpuTimer0.InterruptCount = 0;
    }
}    

void Gpio_select(void)
{
    EALLOW;
    GpioCtrlRegs.GPAMUX1.all = 0;            // GPIO15 ... GPIO0 = General Puropse I/O
    GpioCtrlRegs.GPAMUX2.all = 0;            // GPIO31 ... GPIO16 = General Purpose I/O
   
    GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1;    // SCIRXDA
    GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1;    // SCITXDA   
   
    GpioCtrlRegs.GPBMUX1.all = 0;            // GPIO47 ... GPIO32 = General Purpose I/O
    GpioCtrlRegs.GPBMUX2.all = 0;            // GPIO63 ... GPIO48 = General Purpose I/O
    GpioCtrlRegs.GPCMUX1.all = 0;            // GPIO79 ... GPIO64 = General Purpose I/O
    GpioCtrlRegs.GPCMUX2.all = 0;            // GPIO87 ... GPIO80 = General Purpose I/O
     
    GpioCtrlRegs.GPADIR.all = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO9 = 1;        // peripheral explorer: LED LD1 at GPIO9
    GpioCtrlRegs.GPADIR.bit.GPIO11 = 1;        // peripheral explorer: LED LD2 at GPIO11

    GpioCtrlRegs.GPBDIR.all = 0;            // GPIO63-32 as inputs
    GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;    // peripheral explorer: LED LD3 at GPIO34
    GpioCtrlRegs.GPBDIR.bit.GPIO49 = 1; // peripheral explorer: LED LD4 at GPIO49

    GpioCtrlRegs.GPCDIR.all = 0;            // GPIO87-64 as inputs

    //SL
//    GpioCtrlRegs.GPAPUD.bit.GPIO28=0;
    GpioCtrlRegs.GPAPUD.bit.GPIO28 = 1;   // Disable internal pullup on GPIO28

//  GPIO-28 - PIN FUNCTION = SCI-RX
//    GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1;    // 0=GPIO,  1=SCIRX-A,  2=Resv,  3=Resv
//    GpioCtrlRegs.GPADIR.bit.GPIO28 = 0;        // 1=OUTput,  0=INput
//    GpioDataRegs.GPACLEAR.bit.GPIO28 = 1;    // uncomment if --> Set Low initially
//    GpioDataRegs.GPASET.bit.GPIO28 = 1;        // uncomment if --> Set High initially

    EDIS;
}

void SCIA_init()
{   
       SciaRegs.SCICCR.all =0x0027;       // 1 stop bit,  No loopback
                                       // ODD parity,8 char bits,
                                       // async mode, idle-line protocol
    SciaRegs.SCICTL1.all =0x0003;      // enable TX, RX, internal SCICLK,
                                       // Disable RX ERR, SLEEP, TXWAKE
   
    // SYSCLOCKOUT = 150MHz; LSPCLK = 1/4 = 37.5 MHz
    // BRR = (LSPCLK / (9600 x 8)) -1
    // BRR = 487  gives 9605 Baud
    SciaRegs.SCIHBAUD    = 487 >> 8;        // Highbyte
    SciaRegs.SCILBAUD    = 487 & 0x00FF;    // Lowbyte

    SciaRegs.SCICTL2.bit.TXINTENA = 1; // enable SCI-A Tx-ISR

    //SL
    SciaRegs.SCICTL2.bit.RXBKINTENA=1;    //enable SCI-A Rx-ISR

    SciaRegs.SCICTL1.all = 0x0023;    // Relinquish SCI from Reset


interrupt void cpu_timer0_isr(void)
{
    CpuTimer0.InterruptCount++;        // increment time counter
       GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1; // toggle LED at GPIO34
       // Service the watchdog every Timer 0 interrupt
       EALLOW;
    SysCtrlRegs.WDKEY = 0x55;        // Service watchdog #1
    EDIS;
       // Acknowledge this interrupt to receive more interrupts from group 1
       PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}

interrupt void SCIA_TX_isr(void)     // SCI-A Transmit Interrupt Service
{
    // test for end of string ('\0'); if not, send next character
    if (message[index]!= '\0'    ) SciaRegs.SCITXBUF= message[index++];
    // Acknowledge this interrupt to receive more interrupts from group 9
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP9; 
}

///////////////////////////////////////////////////////////////////////////////////////////

interrupt void SCIA_RX_isr(void)
{
    Uint16 i=0;

    //if this interrup occur, the message has to be change
    char msg[]={"Interrupt RX was here ! # "};

    //overwrite message with new msg
    for(i=0; i<sizeof(msg); i++)
        message[i]=msg[i];

    i++;
    message[i]='\0';

    // Acknowledge this interrupt to receive more interrupts from group 9
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
}

//===========================================================================
// End of SourceCode.
//===========================================================================

  • Steffen,

    Pullup is needed on GPIO28.  So don't disable pullup.

    Using below statement, make GPIO28 as an asynchronous input.

    /* Set qualification for selected pins to asynch only */
    // Inputs are synchronized to SYSCLKOUT by default. 
    // This will select asynch (no qualification) for the selected pins.

      GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3;  // Asynch input GPIO28 (SCIRXDA)

    Regards,
    Vamsi

  • Hello Vamsi,

     

    Thank you for your help!

    I add this command to my code, but there is still the same problem. The signal at GPIO28 never becomes Boolean false, so the SCIRX-A interrupt never occur.

     

    Maybe I should read further manuals and code examples.

     

    Regards,

    Steffen

  • I found the error. The problem is solved.

    It seems that SCI channel A is broken. I switch from SCI channel A to channel B and everything works fine.

    Sometimes I hate hardware.

     

    Regards,

    Steffen

  • Steffen,

    why did you close that Jumper J9? On a F28335Controlcard device U4 (ISO7221) drives its pin 2 as output. Device U1 (FT2232) of the docking station drives its TX pin also as an output. If you close J9, both devices will drive GPIO28 => a classical short, that's also what your screenshot was telling us. No wonder SCI-A is broken now.

    Regards

     

  • Frank Bormann said:

    Steffen,

    why did you close that Jumper J9? On a F28335Controlcard device U4 (ISO7221) drives its pin 2 as output. Device U1 (FT2232) of the docking station drives its TX pin also as an output. If you close J9, both devices will drive GPIO28 => a classical short, that's also what your screenshot was telling us. No wonder SCI-A is broken now.

    Regards

     

    Dear Frank Bormann,

     

    Thank you for your advice. You are right. This is the source of my dilemma.

    At first I only had a look at the circuit diagram of the docking station. I have closed the Jumper J9 to bring the TX signal of the FTDI to the DSP, but this is wrong and not necessary. I ignored U4 (ISO7221) of the controlCard. This IC seems to do what I tried with Jumper9 manually.

    I'm so .... ;(

     

    Regards,

    Steffen

  • Hi Steffen,

    If you'd like to use the FTDI chip on the docking station then besides of closing J9 you also need to remove R12 on the control card. Othervise it will create conflict between two RS232 transceivers, one on the ControlCard and the other one on the docking station. Also, you might need to update the firmware for the FTDI chip. I would strongly recommend to follow this post, and all 3 pages have something important.

    Hardware is beautiful!

     

  • Steffen Lerm said:

    I found the error. The problem is solved.

    It seems that SCI channel A is broken. I switch from SCI channel A to channel B and everything works fine.

    Sometimes I hate hardware.

     

    Regards,

    Steffen

     

    Hi Steffen

     

    I am trying to do the exact same thing as you have described in this post,- and i'm having the exact same problem.

     

    I am running the same program as you, except that i use hyperterminal on the PC. When i connect with hyperterminal i receive the message on the PC, however it looks strange as instead of: "The F28335 - UART ISR is fine ! # ", i get: "T`¡*d’#ŽffÍ - Uh `M‰%D’SRJ›d[›Sh6`ˆÈ #þ`hTh¡*d’#ŽffÍ - U `M‰%D’SRJ›d[›Sh6`ˆÈ #", but that is another problem. The main problem is the same as yours; when i connect an osciloscope to pin28 (RX) then i only recieve boolean high (3.3), no 0V. And i can confirm that hyperterminal writes to the COM port of XDS100 channel B.

    If changing from SCI-A to SCI-B was the solution in your case, could you then please post some code, or perhaps explain to me how that is done?

    Oh, and i forgot to mention that i haven't closed the J9 jumper.

     

    The schematics for the controlCard version R1.2 is seen here:

    7701.F28335controlCARD-Schem[R1.2].pdf

    I have tried to send data from the PC to the DSP-board, and the data pulses are seen before the MAX3221 but not on GPIO28. See:

    So my quess is that it is either the U4 or the U5 that is broken or do you guys have a better suggestion to why GPIO is allways high (3.3V)?

  • I found out why i got that strange message when i transmittet the string from the MCU. It was due to wrong setup of the hyperterminal. I had disabled parity in hyperterminal but enabled it in the C-code. Now I have disabled it in the c-code, so that part works perfect now.

    For the other issue TI states that I must remove R24, and close jumper J9 in order to recieve data, i have done that and it works now. But i still have some unresolved questions:

    The procedure deactivates the ISO7221 isolater and the MAX3221 driver, but why is it there if it should be disconnected to be used?

    How did you manage to use SCI-B?