Part Number: TMS320F28027F
Tool/software: Code Composer Studio
sir I am using piccolo launchpad(TMS320F28027F) for SCI(UART) communication. The transmitter part is working fine . But the problem is with receiver part .I am sending hex values from raspberry pi to c2000 Rx pin , i didn't get any value at launchpad .
I have added watchpoint at "indata" so that i can see the value received .
program:
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
#include "f2802x_common/include/adc.h"
#include "f2802x_common/include/clk.h"
#include "f2802x_common/include/flash.h"
#include "f2802x_common/include/gpio.h"
#include "f2802x_common/include/pie.h"
#include "f2802x_common/include/pll.h"
#include "f2802x_common/include/sci.h"
#include "f2802x_common/include/wdog.h"
typedef unsigned char BYTE;
typedef uint8_t uint8;
typedef uint32_t uint32;
typedef uint16_t uint16;
typedef uint64_t uint64;
// Prototype statements for functions found within this file.
void scia_init(void);
void scia_fifo_init(void);
void scia_xmit(BYTE a);
void error(void);
void scisend(BYTE a[],int length);
void scireceive(uint32 length, uint8 * data);
void scirs(BYTE data);
// Global counts used in this example
uint16_t LoopCount;
uint16_t ErrorCount;
BYTE bBuf[10];
BYTE blen=10;
BYTE data1;
BYTE indata=0;
ADC_Handle myAdc;
CLK_Handle myClk;
FLASH_Handle myFlash;
GPIO_Handle myGpio;
PIE_Handle myPie;
SCI_Handle mySci;
void main(void)
{
CPU_Handle myCpu;
PLL_Handle myPll;
WDOG_Handle myWDog;
// Initialize all the handles needed for this application
myAdc = ADC_init((void *)ADC_BASE_ADDR, sizeof(ADC_Obj));
myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj));
myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj));
myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj));
myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj));
mySci = SCI_init((void *)SCIA_BASE_ADDR, sizeof(SCI_Obj));
myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj));
// Perform basic system initialization
WDOG_disable(myWDog);
CLK_enableAdcClock(myClk);
(*Device_cal)();
//Select the internal oscillator 1 as the clock source
CLK_setOscSrc(myClk, CLK_OscSrc_Internal);
// Setup the PLL for x10 /2 which will yield 50Mhz = 10Mhz * 10 / 2
PLL_setup(myPll, PLL_Multiplier_10, PLL_DivideSelect_ClkIn_by_2);
// Disable the PIE and all interrupts
PIE_disable(myPie);
PIE_disableAllInts(myPie);
CPU_disableGlobalInts(myCpu);
CPU_clearIntFlags(myCpu);
// If running from flash copy RAM only functions to RAM
#ifdef _FLASH
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
#endif
// Setup GPIO
GPIO_setPullUp(myGpio, GPIO_Number_28, GPIO_PullUp_Enable);
GPIO_setPullUp(myGpio, GPIO_Number_29, GPIO_PullUp_Disable);
GPIO_setQualification(myGpio, GPIO_Number_28, GPIO_Qual_ASync);
GPIO_setMode(myGpio, GPIO_Number_28, GPIO_28_Mode_SCIRXDA);
GPIO_setMode(myGpio, GPIO_Number_29, GPIO_29_Mode_SCITXDA);
while(1)
{
while(SciaRegs.SCIRXST.bit.RXRDY!=0)
{
indata=SciaRegs.SCIRXBUF.all;
}
}
}
// Step 7. Insert all local Interrupt Service Routines (ISRs) and functions here:
void error(void)
{
ErrorCount++;
asm(" ESTOP0"); // Uncomment to stop the test here
for (;;) {
}
}
void scia_init()
{
CLK_enableSciaClock(myClk);
// 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SCI_disableParity(mySci);
SCI_setNumStopBits(mySci, SCI_NumStopBits_One);
SCI_setCharLength(mySci, SCI_CharLength_8_Bits);
// enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
SCI_enableTx(mySci);
SCI_enableRx(mySci);
SCI_enableTxInt(mySci);
SCI_enableRxInt(mySci);
SCI_enableLoopBack(mySci);
SCI_setBaudRate(mySci, SCI_BaudRate_9_6_kBaud);
// SCI BRR = LSPCLK/(SCI BAUDx8) - 1
#if (CPU_FRQ_50MHZ)
SCI_setBaudRate(mySci, SCI_BaudRate_9_6_kBaud);
#elif (CPU_FRQ_40MHZ)
SCI_setBaudRate(mySci, (SCI_BaudRate_e)129);
#endif
SCI_enable(mySci);
return;
}
//===========================================================================
// No more.
//===========================================================================