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.

LAUNCHXL-F28069M: SCI: Not Able To Transmit Data Through Motorware Drivers With SCI Code Only

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: C2000WARE, MOTORWARE

In another thread attempting to get sci to work with motorware drivers, I had a lot of responses and in the end  Ms.  suggested that I simplify the problem and just try to write a simple program with only the SCI code and no motor code to pinpoint where the problem is in my program.  I have done that, but unfortunately still having issues and I am not quite sure where.  I have had success getting data to show up with my salae logic analyzer and running the sci_echoback program that is located in the ti folder system at ti/C2000/C2000Ware_4_01_00_00/device_support/f2806x/c28/sci_echoback.  I created a brand new program and imported the folders, such as the SCI.h/SCI.c, GPIO.h/...... etc,  that proj_lab10d used, located in,  ti/C2000/C2000Ware_4_01_00_00/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2806xF/projects/ccs.  In my simple program I followed the ti/motorware/motorware_1_01_00_18/docs/tutorials/motorware_hal_tutorial.pdf, that guides the user to adding sci functionality into a Motorware project.  However, I was unable to see any data coming through my salae logic analyzer.  I looked at all the registers in both programs and compared them and it seems that they all have the same hex values, except for the baud rate.  So, I am confused as to why I am not seeing data.  Maybe the GPIO28 and GPIO29 that are referenced in the drivers for the motorware classes are different from the simple echoback program.  I am not sure.  Any help would be so appreciated. 


sci_echoback code:

main.c

void main(void)
{
    Uint16 ReceivedChar;
    char *msg;

    //
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the F2806x_SysCtrl.c file.
    //
    InitSysCtrl();

    //
    // Step 2. Initalize GPIO:
    // This example function is found in the F2806x_Gpio.c file and
    // illustrates how to set the GPIO to its 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 F2806x_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 F2806x_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 F2806x_DefaultIsr.c.
    // This function is found in F2806x_PieVect.c.
    //
    InitPieVectTable();

    //
    // Step 4. Initialize all the Device Peripherals:
    // This function is found in F2806x_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 !=1)
//        {
//            //
//            // 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++;
    }
}

//
// scia_echoback_init - Test 1,SCIA  DLB, 8-bit word, baud rate 0x0103, 
// default, 1 STOP bit, no parity
//
void
scia_echoback_init()
{
    //
    // Note: Clocks were turned on to the SCIA peripheral
    // in the InitSysCtrl() function
    //
    
    //
    // 1 stop bit,  No loopback, No parity,8 char bits, async mode,
    // idle-line protocol
    //
    SciaRegs.SCICCR.all =0x0007;
    
    //
    // enable TX, RX, internal SCICLK, Disable RX ERR, SLEEP, TXWAKE
    //
    SciaRegs.SCICTL1.all =0x0003;

    SciaRegs.SCICTL2.bit.TXINTENA = 0;
    SciaRegs.SCICTL2.bit.RXBKINTENA = 0;

    //
    // 9600 baud @LSPCLK = 22.5MHz (90 MHz SYSCLK)
    //
    SciaRegs.SCIHBAUD    =0x0001;
    SciaRegs.SCILBAUD    =0x0024;

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

//
// scia_xmit - Transmit a character from the SCI
//
void
scia_xmit(int a)
{
    while (SciaRegs.SCIFFTX.bit.TXFFST != 0)
    {

    }
    SciaRegs.SCITXBUF=a;
}

//
// scia_msg - 
//
void
scia_msg(char * msg)
{
    int i;
    i = 0;
    while(msg[i] != '\0')
    {
        scia_xmit(msg[i]);
        i++;
    }
}

//
// scia_fifo_init - Initalize the SCI FIFO
//
void
scia_fifo_init()
{
    SciaRegs.SCIFFTX.all=0xE040;
    SciaRegs.SCIFFRX.all=0x2044;
    SciaRegs.SCIFFCT.all=0x0;
}


F2806x_Sci.c:  InitSciaGpio() function called in main.c

void
InitSciaGpio()
{
    EALLOW;

    //
    // Enable internal pull-up for the selected pins
    // Pull-ups can be enabled or disabled disabled by the user.
    // This will enable the pullups for the specified pins.
    //
    GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0;  // Enable pull-up for GPIO28 (SCIRXDA)
    //GpioCtrlRegs.GPAPUD.bit.GPIO7 = 0;  // Enable pull-up for GPIO7 (SCIRXDA)

    GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0;	 // Enable pull-up for GPIO29 (SCITXDA)
    //GpioCtrlRegs.GPAPUD.bit.GPIO12 = 0; // Enable pull-up for GPIO12 (SCITXDA)

    //
    // 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)
    //GpioCtrlRegs.GPAQSEL1.bit.GPIO7 = 3;   // Asynch input GPIO7 (SCIRXDA)

    //
    // Configure SCI-A pins using GPIO regs
    // This specifies which of the possible GPIO pins will be SCI functional 
    // pins.
    //
    
    //
    // Configure GPIO28 for SCIRXDA operation
    //
    GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1;
    
    //
    // Configure GPIO7  for SCIRXDA operation
    //
    //GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 2;

    //
    // Configure GPIO29 for SCITXDA operation
    //
    GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1;
    
    //
    // Configure GPIO12 for SCITXDA operation
    //
    //GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 2;

    EDIS;
}
#endif // endif DSP28_SCIA

New program using the files used in proj_lab10d:   I tried using SCI_putDataNonBlocking() as this was used in the motorware_hal_tutorial, and I also tried to use the SCI_write() function

main.c

#include "sw/drivers/sci/src/32b/f28x/f2806x/sci.h"
#include "sw/drivers/clk/src/32b/f28x/f2806x/clk.h"
#include "sw/drivers/gpio/src/32b/f28x/f2806x/gpio.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
/**
 * main.c
 */

void setupSciA(SCI_Handle sciAHandle);

int main(void)
{
    SCI_Handle sciAHandle;
    CLK_Handle clkHandle;
    GPIO_Handle gpioHandle;

    sciAHandle = SCI_init((void *)SCIA_BASE_ADDR,sizeof(SCI_Obj));
    clkHandle = CLK_init((void *)CLK_BASE_ADDR,sizeof(CLK_Obj));
    gpioHandle = GPIO_init((void *)GPIO_BASE_ADDR,sizeof(GPIO_Obj));

    setupSciA(sciAHandle);
    CLK_enableSciaClock(clkHandle);

    // UARTA RX
    GPIO_setMode(gpioHandle,GPIO_Number_28, GPIO_28_Mode_SCIRXDA);
    GPIO_setMode(gpioHandle,GPIO_Number_29,GPIO_29_Mode_SCITXDA);

    for(;;) {
        SCI_write(sciAHandle, 110);
    }
}

void setupSciA(SCI_Handle sciAHandle) {

    SCI_reset(sciAHandle);
    SCI_enableTx(sciAHandle);
    SCI_enableRx(sciAHandle);

    SCI_disableParity(sciAHandle);
    SCI_setNumStopBits(sciAHandle,SCI_NumStopBits_One);
    SCI_setCharLength(sciAHandle,SCI_CharLength_8_Bits);
    SCI_setBaudRate(sciAHandle,(SCI_BaudRate_e)(0x0061));
    SCI_setPriority(sciAHandle,SCI_Priority_FreeRun);

    SCI_enable(sciAHandle);

    return;

}

Sci.c => SCI_init() function

SCI_Handle SCI_init(void *pMemory,const size_t numBytes)
{
  SCI_Handle sciHandle;


  if(numBytes < sizeof(SCI_Obj))
    return((SCI_Handle)NULL);

  // assign the handle
  sciHandle = (SCI_Handle)pMemory;
  
  return(sciHandle);
}

Clk.c => CLK_init() function

CLK_Handle CLK_init(void *pMemory,const size_t numBytes)
{
  CLK_Handle clkHandle;


  if(numBytes < sizeof(CLK_Obj))
    return((CLK_Handle)NULL);

  // assign the handle
  clkHandle = (CLK_Handle)pMemory;

  return(clkHandle);
}

gpio.c => GPIO_init() function

GPIO_Handle GPIO_init(void *pMemory,const size_t numBytes)
{
  GPIO_Handle gpioHandle;


  if(numBytes < sizeof(GPIO_Obj))
    {
      return((GPIO_Handle)NULL);
    }

  // assign the handle
  gpioHandle = (GPIO_Handle)pMemory;

  return(gpioHandle);
}

clk.c => CLK_enableSciaClock() function

void CLK_enableSciaClock(CLK_Handle clkHandle)
{
  CLK_Obj *clk = (CLK_Obj *)clkHandle;


  ENABLE_PROTECTED_REGISTER_WRITE_MODE;

  // set the bits
  clk->PCLKCR0 |= CLK_PCLKCR0_SCIAENCLK_BITS;

  DISABLE_PROTECTED_REGISTER_WRITE_MODE;

  return;
}

gpio.c => GPIO_setMode() function

void GPIO_setMode(GPIO_Handle gpioHandle,const GPIO_Number_e gpioNumber,const GPIO_Mode_e mode)
{
  GPIO_Obj *gpio = (GPIO_Obj *)gpioHandle;


  ENABLE_PROTECTED_REGISTER_WRITE_MODE;

  if(gpioNumber < (GPIO_GPMUX_NUMGPIOS_PER_REG * 1))
    {
      uint_least8_t lShift = gpioNumber << 1;
      uint32_t clearBits = (uint32_t)GPIO_GPMUX_CONFIG_BITS << lShift;
      uint32_t setBits = (uint32_t)mode << lShift;

      // clear the bits
      gpio->GPAMUX1 &= (~clearBits);

      // set the bits
      gpio->GPAMUX1 |= setBits;
    }
  else if(gpioNumber < (GPIO_GPMUX_NUMGPIOS_PER_REG * 2))
    {
      uint_least8_t lShift = (gpioNumber - (GPIO_GPMUX_NUMGPIOS_PER_REG * 1)) << 1;
      uint32_t clearBits = (uint32_t)GPIO_GPMUX_CONFIG_BITS << lShift;
      uint32_t setBits = (uint32_t)mode << lShift;

      // clear the bits
      gpio->GPAMUX2 &= (~clearBits);

      // set the bits
      gpio->GPAMUX2 |= setBits;
    }
  else if(gpioNumber < (GPIO_GPMUX_NUMGPIOS_PER_REG * 3))
    {
      uint_least8_t lShift = (gpioNumber - (GPIO_GPMUX_NUMGPIOS_PER_REG * 2)) << 1;
      uint32_t clearBits = (uint32_t)GPIO_GPMUX_CONFIG_BITS << lShift;
      uint32_t setBits = (uint32_t)mode << lShift;

      // clear the bits
      gpio->GPBMUX1 &= (~clearBits);

      // set the bits
      gpio->GPBMUX1 |= setBits;
    }
  else if(gpioNumber < (GPIO_GPMUX_NUMGPIOS_PER_REG * 4))
    {
      uint_least8_t lShift = (gpioNumber - (GPIO_GPMUX_NUMGPIOS_PER_REG * 3)) << 1;
      uint32_t clearBits = (uint32_t)GPIO_GPMUX_CONFIG_BITS << lShift;
      uint32_t setBits = (uint32_t)mode << lShift;

      // clear the bits
      gpio->GPBMUX2 &= (~clearBits);

      // set the bits
      gpio->GPBMUX2 |= setBits;
    }

  DISABLE_PROTECTED_REGISTER_WRITE_MODE;

  return;
}

sci.h => SCI_write() function

static inline void SCI_write(SCI_Handle sciHandle,const uint16_t data)
{
  SCI_Obj *sci = (SCI_Obj *)sciHandle;


  // write the data
  sci->SCITXBUF = data;

  return;
}

sci.h => SCI_putDataNonBlocking() function

 

uint16_t SCI_putDataNonBlocking(SCI_Handle sciHandle, uint16_t data)
{
  SCI_Obj *sci = (SCI_Obj *)sciHandle;

  if(SCI_txReady(sciHandle))
    {
      // write the data
      sci->SCITXBUF = data;

      return(true);
    }

  return(false);
}

Here are the register values of each program:

ECHOBACK PROGRAM			SCI TEST PROGRAM


GPIO INIT'S

GPAPUD ->  0x00000FFF			GPAPUD ->  0x00000FFF
GPAQSEL2 -> 0x03000000			GPAQSEL2 -> 0x03000000
GPAMUX2 -> 0x05000000			GPAMUX2 -> 0x05000000

SCIA INIT'S

SCIFFTX -> 0xA000   			SCIFFTX -> 0xA000  
SCIFFRX -> 0x201F			SCIFFRX -> 0x201F
SCIFFCT -> 0x0000			SCIFFCT -> 0x0000
SCICCR -> 0x0007			SCICCR -> 0x0007
SCICTL1 -> 0x0003		SCICTL1 -> 0x0023
SCICTL2 -> 0x0000		SCICTL2 -> 0x00C3
SCIHBAUD -> 0x0001			SCIHBAUD -> 0x0000 OK
SCILBAUD -> 0x0024			SCIHBAUD -> 0x00017 OK 115200
SCICTL1 -> 0x0023

Here is the output on the logic analyzer:   It just continually outputs the string "Enter a character":

  • Hi Charlie,

    Here is the output on the logic analyzer:   It just continually outputs the string "Enter a character":

    Within the for loop of your main.c you continuously transmit "Enter a character". To me, it seems like your program is transmitting correctly. Is the end goal to transmit data to a terminal and be able to receive data? If you uncomment the rest of the code in the for loop does the program work as intended?

    Best Regards,

    Marlyn

  • So the code that produces the "Enter a character" is the simple echo back program.  The other program is the simple program that you suggested to make and it does not produce anything to the logic analyzer. 

    The end goal is to get the TX and RX communication to work in a program with spinning a motor.  I am simply trying to get remote input from a bluetooth device and transmit it into data to spin the motor. I started with just trying to output TX data to get it working.  After that is working, I just wanted to set it up to receive RX information from the incoming bluetooth joystick input and turn that into data of how fast to spin the motor.  

    I will have an xbee antenna attached to the LaunchpadXL-F28069M and it will receive communication from joysticks hooked up to a second xbee antenna.  I have used xbee's program and tested the xbee devices.  I hooked one xbee device up to my computer with a usb tx/rx cable and just had the other joystick with the xbee device powered up, but not hooked up to the computer.  And I was able to see data coming in from the joystick to the antenna connected to the computer.  

  • Hi Charlie,

    I looked at all the registers in both programs and compared them and it seems that they all have the same hex values, except for the baud rate. 

    What is the value of the baud rate in your simple program?

    Best Regards,

    Marlyn

  • Yes the baud rate is different.  The baud rate in the simple program is 115200 and I matched that on the logic analyzer.  The baud in the echoback is 9600 and I made sure to match that in the logic analyzer too.  I went with 115200 in the simple program as that is what they did in the hal tutorial for adding sci to a hal motor project. I could try and change the baud rate, but I would not think that would make a difference in whether you see data correct?  If you had the wrong baud, it would just come out as garbage correct?  However, I see no data at all with the simple program.

  • Thank you for the explanation Charlie. Can you please attach your project? I will try to run it on my end and verify what you are seeing.

    Best Regards,

    Marlyn

  • Here is the project on a github repo to make it easy to download.  Let me know if you can not clone it or get the code
    github.com/.../SCI_Test

    I could not see a way to attach it to the thread here...   

  • Thank you Charlie. I am traveling at the moment and am not able to test out the code. Please expect a reply from me early next week.

    Best Regards,

    Marlyn

  • Hi Charlie,

    In what directory did you place your simple project?

    Best Regards,

    Marlyn

  • I just created a new project inside the code composer studio ide.  So it should just go in there. And I added paths to include all the sci and other libraries I needed

  • Charlie,

    Even when you create a project in CCS it will by default add it to a specific location. Can you please check the project properties within your CCS to identify this path? The reason I ask is because your includes for the header files seem to be pointing to relative paths so I am not able to build the project correctly.

    Best Regards,

    Marlyn

  • Oh ok.  I have been out of town.  I will check tonight when I get home 

  • Sounds good, thank you Charlie.

    Best Regards,

    Marlyn

  • The path on my computer

    C:\Users\cbarb\workspace_v11\Sci_Test

  • Thank you Charlie, I was able to successfully build the project. I will test it on the launchpad and get back to you. 

    Best Regards,

    Marlyn

  • do you see anything incorrect related to setting up the SCI handle? When I build the project, the SCI registers aren't setup. 

    Best Regards,

    Marlyn

  • I think you need to enable the clock to SCIA before you can configure the registers. Basically swap these two lines:

        CLK_enableSciaClock(clkHandle);
        setupSciA(sciAHandle);

    Whitney

  • I had tried swapping that too and that didn't affect anything.

    Best Regards,

    Marlyn

  • It should at least fix the issues where the SCI registers aren't setup, although I can see where the test application would still have some issues--there's no InitSysCtrl() (or equivalent), so no SYSCLK set up, watchdog is still enabled, etc...

    Whitney

  • Hi Marlyn, 

    Have you had any luck with Whitney's suggestion?  Is there anything that I could try?

  • Hi Charlie,

    Can you please try Whitney's suggestions? You are missing all of the initial setup like calling InitSysCtrl(), I suggest you look at main() from the echoback example and call the same setup in your simple program.

    Best Regards,

    Marlyn

  • I will try that, but did not she say there are other possible issues other than that in her last comment? And that solves one of the issues.

  • Charlie,

    Whitney meant that you should probably enable the clock to SCIA before you configure the SCI registers (this should fix the SCI register issues). Additionally, you need to call InitSysCtrl() (or equivalent) before you do anything else to get the overall device clocks setup etc. 

    Please try these things and if you are still facing issues we can continue to debug.

    Best Regards,

    Marlyn

  • Hi Marlyn,

       I added a a new function initializing all of the things that were in the InitSysCtrl() function of the echoback program.  When running my analyzer, I get what looks like garbage data and it says framing error.  So I guess this is promising as I was getting nothing at all before.  Maybe it is just the way I'm sending the data?  Maybe there is data now going through the SCIATX now though?  I tried to change the baud rate, but no luck.  Still just showed the !!!!!'s 

    Check out the new code I added in my main function.

    https://github.com/cbarb15/SCI_Test

  • It seems to be working if I put in 

    uint16_t number16 = 0xFFFF;

    where I'm calling SCI_write() in the program.

    It seems to throw framing errors if I change it off of the 0xFFFF.  

  • It seems to be working if I put in 

    uint16_t number16 = 0xFFFF;

    where I'm calling SCI_write() in the program.

    It seems to throw framing errors if I change it off of the 0xFFFF.  

    I also tried to see if I could read what is coming in from the RX pin by putting 

    uint16_t rxData = SCI_read(sciAHandle);
    SCI_write(sciAHandle, rxData);

    in the for(;;)  loop.  I got the framing error again though.  

    I have to Xbee receivers set up.  One is attached to an arduino nano every and has a program that is sending out the position of the joystick.  I used my logic analyzer and tested what is going into the antenna that is hooked up to the Launchpad and I can see it is sending data perfectly.  
    However, if I hook the TX of the antenna to the RX of the board and put the above code in there it gives a framing error.  
    Seems like we are getting closer though. 

  • Hi Charlie,

    I got the framing error again though.  

    Can you please confirm the baud rate of both devices? Also, what voltage levels are the other devices using? wondering if you need to consider level shifters? This could be another probable cause for framing errors.

    Best Regards,

    Marlyn

  • Ok so I changed the baud rate in the program to 9600 on both. It appears to be working, but I am not able to verify through the board if I am getting values.  I am 1000% sure that there are values coming to the antenna hooked up to the F2806M. There is a software that you can use with the Xbee and hook it up through a serial usb to see the values being output.  I just do not know if my code is reading in the data correctly through the RX and writing it to the TX correctly.  I look at the registers and move the joystick attached to the arduino, but I do not see anything change in the registers.  

    Here is a shot of the registers.  Maybe you need to look at other ones.  Just let me know.  And the little lights on the antenna board are blinking indicating it is receiving messages.  I just want to print out what is coming in through the RX pin on the board.  

    LATEST CODE:
    github.com/.../SCI_Test

  • Hi Charlie,

    I just do not know if my code is reading in the data correctly through the RX and writing it to the TX correctly.  I look at the registers and move the joystick attached to the arduino, but I do not see anything change in the registers.  

    I think it would help to isolate the communication (for debugging purposes). What happens when you physically connect the TX pin to the RX pin on the launchpad? Are you able to receive back the data that you transmit? If you are then communication on the device is okay and your issue may be somewhere else within the system.

    Best Regards,

    Marlyn

  • I'm not quite sure how to see the data I am getting back when doing as you said with the tx to rx as it won't print to the console as I've changed the headers

    I have not had any luck getting printf to work in code composer.  And I tried to put the tx of the antenna on into the breakout board, the breakout board to the rx of the launchpad, and then read what was coming out of the rx by putting a breakout board to my logic analyzer.  I got numbers, but they would not change

    when moving the joystick

    .   .  

  • Hi Charlie,

    I'm not quite sure how to see the data I am getting back when doing as you said with the tx to rx as it won't print to the console as I've changed the headers

    After reading the data you can place it in an array or variable and be able to view that within the 'Expression Window' of CCS or even look at the RX register itself to view the received data. I'd like to just confirm that something the launchpad is transmit can be read back to make sure your device/software is setup correctly, without involving other components. 

    Best Regards,

    Marlyn

  • Ok so I attached the tx to the rx like you said, modified the program a little and ran it.  As you will see in the video, nothing show up in the rx register at first.  When I disconnect and reconnect the target you can see the hex for the first value of the letter Z. However, I would think that it would alternate back and forth in the rx register between the letter Z and the letter H as I write one after the other.  But I only ever see one. I did enable continuous refresh as well. I searched the forums and maybe this is to do with a clock or something. 

    Latest Code:

    SCI_Test/Sci_Test at main · cbarb15/SCI_Test (github.com)

    First here is a video of the data being sent from the joystick for an insanity check to the software that works with the xbee hardware:

    https://drive.google.com/file/d/1Jpr1AZV5wBUb6ixabIrz4nz1si1Mz-5e/view?usp=share_link

    Here is the video when running the program with TX connected to RX:

    https://drive.google.com/file/d/1U6GkhQDx2ynvZFR0nRt9qhgbjcXSF88r/view?usp=share_link

    Then I attached the Xbee module back to the board and here is a picture of the registers.  They change once when doing the connect and disconnect, but it is not anything I would expect to see.  And it is not going into the SCIRXBUF like the other program where TX was connected to RX.  

  • Charlie,

    And it is not going into the SCIRXBUF like the other program where TX was connected to RX.  

    In the photo you attached I see the same content in SCITXBUF as SCIRXBUF. Are you transmitting 4F?

    Also, if you run the loopback example (in C2000Ware), everything works as expected? For this test I would disable the loopback bit and then externally connect TX and RX. I want to make sure there isn't anything incorrect with the hardware, this is a software issue. 

    Best Regards,

    Marlyn

  • So, if I run the echoback program and connect the TX to RX, it looks like there is the hex value for the letter l in the TX buffer and the hex value for the letter H in the RX buffer. If I put my logic analyzer on the TX pin, it is transmitting "Hello" over and over.  

     I would expect the SCIRXBUF and SCITXBUF to be changing continuously and showing the different hex values of the different letters in "Hello".   When I have run the motorware project 10d, the registers are changing constantly showing the speed and a lot of other things.  Is there something that you have to do to enable that in other programs such as the echoback?  

    Here is the code in for loop in the echoback program

    Here are the registers:

    Also, sometimes when I run the program it will have nothing in the RX and TX buffers and then if I stop and rerun the program it will have those hex values in there.  

    I also ran my simple program and it seems to be working.  But it does the same thing where I run it the first time and there is nothing in there and then I stop it and re run and the letter z hex value is in there.  Why would this be?  

    Is there a way to be able to see the registers changing continuously like the motorlab proj10d?

  • Hi Charlie,

    Sorry I meant running the loopback example not the echoback example. Make sure to disable the loopback bit though and connect RX/TX externally. 

    C:\ti\c2000\C2000Ware_version\device_support\f2806x\examples\c28\scia_loopback

    Is there a way to be able to see the registers changing continuously like the motorlab proj10d?

    I see you have the 'continuous refresh' set in the expression window, this is the only way to view the registers as they change continuously. 

    Best Regards,

    Marlyn

  • Ok so the loopback worked well the first time.  The registers were yellow and constantly changing.  However, now trying to run it with continuous refresh on the registers are not changing anymore.  Not sure what I did wrong now.  Do you also have to run the real time silicone debug?

    Code composer seems really finicky.  I deleted the program from the workspace, imported it back in, cleaned it and then ran it.  I selected the above button and the continuous refresh and pressed play.  All the registers were changing beautifully.  Then I pressed the stop button and tried to run it again with all the same steps and the registers don't change anymore.  It is very frustrating. Not sure why this is happening.  

  • Hi Charlie,

    However, now trying to run it with continuous refresh on the registers are not changing anymore.

    You had the correct setting with the below. The icon with the two yellow arrows with a bar behind them is the 'continuous refresh" button. I would stick with this to monitor any expression/register settings.

    Can you try running the loopback example again? If you are able to get the right functionality then there is nothing wrong with the hardware. I would compare the setup of this project (code) against your own. My inclination is that the FIFOs are not setup accordingly based on the data you expect. This is an application issue. 

    Best Regards,

    Marlyn

  • Hi Marlyn,

       So I am rarely able to see the registers change with continuous refresh.  Once in a while it runs correctly and shows the registers changing, but then after I stop the program when it is showing them and try to run it again it does not work again.  I am not sure why.  The TX is connected to the RX line on the board during this program.

  • Charlie,

    Could you please try the following? 

    Within the loopback example move 'SendChar' and 'ReceivedChar' to be global defines. When you debug the project add these variables to the expression window. Enable the refresh, and see if these variables change for you?

    //
    // Globals
    //
    Uint16 LoopCount;
    Uint16 ErrorCount;    
    Uint16 SendChar;
    Uint16 ReceivedChar;
    
    //
    // Main
    //
    void main(void)
    {
    
    
        //
        // Step 1. Initialize System Control registers, PLL, WatchDog, Clocks to 
        // default state: This function is found in the F2806x_SysCtrl.c file.
        //
        InitSysCtrl();

    Best Regards,

    Marlyn

  • That did the trick.  It is showing in the registers too.  Thank you.  I will model my simple program after this one and see if I can get it working.

  • So from my simple program I was sending the letterZ and letterH in hex value back and forth to see the values change and it worked well.  So I am trying to send the same type of value from my arduino to the launchpad.  But I am unable to see anything but what seems like garbage.  I just see a decimal value of 252 which translates to 0x00FC which I am not sending.  I know that the SCI_read() function expects a uint16_t so I made sure that was what I was sending, but I still see the 252 instead of 72 as I sent 0x48, which is the letter Z.  I connected the tx of the arduino directly to the RX of the launchpad to cut out any problems from the Xbee's.  However, I am still not seeing what should be coming through.

  • Hi Charlie,

    Please ensure that the arduino device has the same baud rate setup as the F28379D launchpad. Secondly, have you scoped the TX pin of the arduino to make sure that the transmitted data from the arduino is correct? If it is, I would suggest checking to see if you have any kind of SCI errors on the launchpad through the registers. 

    Here more info on possible things to check: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1031947/faq-my-c2000-sci-is-not-transmitting-and-or-receiving-data-correctly-how-do-i-fix-this 

    Best Regards,

    Marlyn

  • Hi Marlyn,

       So I adjusted the baud rate and I'm seeing data come through, but it is not what I expected.  I put a logic analyzer on the tx pin of my arduino and when the joystick is not moved at all the values are 512 for x and 512 for y.  However, in the variables for the rx data in code composer I am seeing numbers alternating between 50 and 48.  I thought maybe it could be that I'm sending an int from the arduino and the SCI_read(sciAHandle) function is returning a uint16_t.  I also tried to send a uint16_t from my arduino and it shows the same. 

  • Charlie,

                 Marlyn is out-of-the office (and so are many other subject-matter-experts). She will be back in the first week of January, at which time you can expect a response. Thank you for your understanding and patience.

  • Hi Charlie,

    Do you observe any errors in the SCIRXST register? If the F2806x device can transmit and receive properly when you send and receive data with an external loopback connection then the issue is with the connection to the Arduino device.  Other than double checking the baud rate, and setup (one stop bit etc.), I am not sure what else to suggest as this is more of an application issue. Make sure that both devices are operating at the same voltage level (SCI RX pin high should be ~3.3V).

    Best Regards,

    Marlyn

  • I wonder if what the Launchpad is reading is analog signals.  I know the arduino's have a analog to digital converter.  Is there something like that on the TI Lauchpad-F28069M?  Is there a TI bluetooth receiver from Texas Instruments that could connect to the Launchpad-F28069M and then another board that I could use from TI to make the bluetooth sender as a remote and plug joysticks into it?  I saw there was the CC2340 family.  Would that work as a remote device? Maybe using something from TI would play nicer with the launchpad-f28069M.  I'm just trying to find a simple solution.  Any suggestions?

  • Hi Charlie,

    Is there something like that on the TI Lauchpad-F28069M?

    The device does have ADCs on it, but the SCI pins are not shared with any kind of analog module.

    Is there a TI bluetooth receiver from Texas Instruments that could connect to the Launchpad-F28069M and then another board that I could use from TI to make the bluetooth sender as a remote and plug joysticks into it?  I saw there was the CC2340 family. 

    Could you please start a new thread for this? That way the question could get routed to our bluetooth team and they would be able to best provide a solution for you.

    Best Regards,

    Marlyn