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.

lab13b add sci echoback

Other Parts Discussed in Thread: DRV8301-69M-KIT

Hello

I tried the f28027 launchpad sci echoback example and works.

But when I trying to put that into the instaspin motion lab13b

and take test to 1 to send the msg to sciA TX.

I got "?" in my com port.

Any body knows is some thing I missed?

..........................................................................................................................

in hal_obj.h

typedef struct _HAL_Obj_
{

...

SCI_Handle sciAHandle;       //!< the sciA handle

..........................................................................................................................

in hal.h

extern void HAL_setupSci(HAL_Handle handle);

..........................................................................................................................

in hal.c

void HAL_setParams(HAL_Handle handle,const USER_Params *pUserParams)

{

......

// set the sciA
HAL_setupSci(handle);

void HAL_setupPeripheralClks(HAL_Handle handle)
{

...
CLK_enableSciaClock(obj->clkHandle);

void HAL_setupGpios(HAL_Handle handle)
{

...

// SCI RXD A
GPIO_setPullup(obj->gpioHandle, GPIO_Number_28 , GPIO_Pullup_Enable);
GPIO_setQualification(obj->gpioHandle, GPIO_Number_28, GPIO_Qual_ASync);
GPIO_setMode(obj->gpioHandle,GPIO_Number_28,GPIO_28_Mode_SCIRXDA);

// SCI TXD A
GPIO_setPullup(obj->gpioHandle, GPIO_Number_29, GPIO_Pullup_Enable);
GPIO_setMode(obj->gpioHandle, GPIO_Number_29, GPIO_29_Mode_SCITXDA);

void HAL_setupSci(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *)handle;

// 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SCI_disableParity(obj->sciAHandle);
SCI_setNumStopBits(obj->sciAHandle, SCI_NumStopBits_One);
SCI_setCharLength(obj->sciAHandle, SCI_CharLength_8_Bits);

SCI_enableTx(obj->sciAHandle);
SCI_enableRx(obj->sciAHandle);
SCI_enableTxInt(obj->sciAHandle);
SCI_enableRxInt(obj->sciAHandle);

// SCI BRR = LSPCLK/(SCI BAUDx8) - 1
SCI_setBaudRate(obj->sciAHandle, SCI_BaudRate_9_6_kBaud); // 9600 baud
SCI_enable(obj->sciAHandle);

SCI_enableTxFifoEnh(obj->sciAHandle);
SCI_resetTxFifo(obj->sciAHandle);
SCI_clearTxFifoInt(obj->sciAHandle);
SCI_resetChannels(obj->sciAHandle);
SCI_setTxFifoIntLevel(obj->sciAHandle, SCI_FifoLevel_Empty);

SCI_resetRxFifo(obj->sciAHandle);
SCI_clearRxFifoInt(obj->sciAHandle);
SCI_setRxFifoIntLevel(obj->sciAHandle, SCI_FifoLevel_4_Words);

return;
}// end of HAL_setupSci() function

..........................................................................................................................

in proj_lab13b.c

msg = "aaaaa\0";
for(;;)
{
  for(;;){
            if(test>0){
            scia_msg(msg);
            test = 0;
          }
}// Waiting for enable system flag to be set

while(!(gMotorVars.Flag_enableSys));

...

// Transmit a character from the SCI
void scia_xmit(int a)
{
    while(SCI_getTxFifoStatus(halHandle->sciAHandle) != SCI_FifoStatus_Empty)
    {
    }

    SCI_putDataBlocking(halHandle->sciAHandle, a);
}


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

..........................................................................................................................