Below are the changes: (1) hal.h -- (C:\ti\motorware\motorware_1_01_00_17\sw\modules\hal\boards\boostxldrv8305_revA\f28x\f2802x\src) extern interrupt void sciaRxFifoIsr(void); extern void HAL_sciaWrite(HAL_Handle handle, const uint16_t data); extern void HAL_setupSciA(HAL_Handle handle); extern void HAL_sciaWrite(HAL_Handle handle, const uint16_t data); extern uint16_t Hal_sciaRead(HAL_Handle handle); extern void HAL_sciaClearRxFifoOvf(HAL_Handle handle); extern void HAL_sciaClearRxFifoInt(HAL_Handle handle); extern SCI_FifoStatus_e Hal_sciaGetTxFifoStatus(HAL_Handle handle); extern void HAL_pieClearInt(HAL_Handle handle, const PIE_GroupNumber_e groupNumber); Inline function HAL_initIntVectorTable() Added pie->SCIRXINTA = &sciaRxFifoIsr; (2) hal_obj.c (C:\ti\motorware\motorware_1_01_00_17\sw\modules\hal\boards\boostxldrv8305_revA\f28x\f2802x\src) #include "sw/drivers/sci/src/32b/f28x/f2802x/sci.h" Added to "typedef struct _HAL_Obj_" SCI_Handle sciaHandle; SCI_Obj scia; (3) hal.c Modified HAL_init() by adding: obj->sciaHandle = SCI_init((void *) SCIA_BASE_ADDR, sizeof(SCI_Obj)); Modified HAL_setParams() by adding HAL_setupSciA(handle); Modified HAL_setupGpios() by adding GPIO_setPullUp(obj->gpioHandle, GPIO_Number_28, GPIO_PullUp_Enable); GPIO_setPullUp(obj->gpioHandle, GPIO_Number_29, GPIO_PullUp_Enable); GPIO_setQualification(obj->gpioHandle, GPIO_Number_28, GPIO_Qual_ASync); GPIO_setMode(obj->gpioHandle, GPIO_Number_28, GPIO_28_Mode_SCIRXDA); GPIO_setMode(obj->gpioHandle, GPIO_Number_29, GPIO_29_Mode_SCITXDA); Added Below set of functions ========================================================================================= // ************************************************************************** // the functions //Added void HAL_setupSciA(HAL_Handle handle) { HAL_Obj *obj = (HAL_Obj *) handle; //CLK_enableSciaClock(obj->clkHandle); // no need to call again, already set in HAL_setupPeripheralClks() -maria- // SCI stop bit, parity, loopback, char bits, idle/address mode (SCICCR = 0x07) SCI_setNumStopBits(obj->sciaHandle, SCI_NumStopBits_One); // SCICCR bit 7 SCI_enableParity(obj->sciaHandle); // SCICCR bit 5 SCI_setParity(obj->sciaHandle, SCI_Parity_Even); // SCICCR bit 6 SCI_disableLoopBack(obj->sciaHandle); // SCICCR bit 4 SCI_setMode(obj->sciaHandle, SCI_Mode_IdleLine); // SCICCR bit 3 SCI_setCharLength(obj->sciaHandle, SCI_CharLength_8_Bits); // SCICCR bit 0-2 // TX enable, RX enable, RX ERR INT enable, SLEEP, TXWAKE (SCICTL1 = 0x03) SCI_disableRxErrorInt(obj->sciaHandle); // SCICTL1 bit 6 SCI_disable(obj->sciaHandle); // SCICTL1 bit 5 SCI_disableTxWake(obj->sciaHandle); // SCICTL1 bit 3 SCI_disableSleep(obj->sciaHandle); // SCICTL1 bit 2 SCI_enableTx(obj->sciaHandle); // SCICTL1 bit 1 SCI_enableRx(obj->sciaHandle); // SCICTL1 bit 0 // TXINT enable, RXINT enable, TXEMPTY, TXRDY (SCICTL2 = 0x03) SCI_enableRxInt(obj->sciaHandle); // SCICTL2 bit 1 SCI_disableTxInt(obj->sciaHandle); // SCICTL2 bit 0 // SCIH-SCIL BAUD - SCI_BAUD = (LSPCLK/(SCI_BRR*8)) - 1 SCI_setBaudRate(obj->sciaHandle, SCI_BaudRate_9_6_kBaud); // Reset SCI SCI_enable(obj->sciaHandle); // PIE_enableSciInt(obj->pieHandle, SCI_RXA); // enable SCI interrupt PIE_enableInt(obj->pieHandle, PIE_GroupNumber_9, PIE_InterruptSource_SCIARX); //CPU_enableGlobalInts(obj->cpuHandle); // no need to call again -maria- CPU_enableInt(obj->cpuHandle, CPU_IntNumber_9); // enable CPU interrupt 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(mySci, SCI_FifoLevel_4_Words); SCI_setRxFifoIntLevel(obj->sciaHandle, SCI_FifoLevel_1_Word); //SCI_disableLoopBack(obj->sciaHandle); } //Added by Maya void HAL_sciaWrite(HAL_Handle handle, const uint16_t data) { HAL_Obj *obj = (HAL_Obj *) handle; SCI_write(obj->sciaHandle, data); } //SCI uint16_t Hal_sciaRead(HAL_Handle handle){ HAL_Obj *obj = (HAL_Obj *) handle; return SCI_read(obj->sciaHandle); } // Clear Overflow flag void HAL_sciaClearRxFifoOvf(HAL_Handle handle) { HAL_Obj *obj = (HAL_Obj *) handle; SCI_clearRxFifoOvf(obj->sciaHandle); } // Clear Interrupt flag void HAL_sciaClearRxFifoInt(HAL_Handle handle) { HAL_Obj *obj = (HAL_Obj *) handle; SCI_clearRxFifoInt(obj->sciaHandle); } SCI_FifoStatus_e Hal_sciaGetTxFifoStatus(HAL_Handle handle) { HAL_Obj *obj = (HAL_Obj *) handle; return SCI_getTxFifoStatus(obj->sciaHandle); } // Issue PIE ack void HAL_pieClearInt(HAL_Handle handle, const PIE_GroupNumber_e groupNumber) { HAL_Obj *obj = (HAL_Obj *) handle; PIE_clearInt(obj->pieHandle, groupNumber); } ========================================================================================= (4) main.h (C:\ti\motorware\motorware_1_01_00_17\sw\solutions\instaspin_foc\src) Added interrupt void sciaRxFifoIsr(void); (5) proj_lab05a.c Added below code after the "for(;;)" for(;;) { //GPIO_setHigh(gpioHandle, GPIO_Number_18); HAL_setGpioHigh(halHandle,GPIO_Number_18); usDelay(2000); scia_xmit(0xA2); if(encoderTipoLeitura == 0) { scia_xmit(0xB0); } else { scia_xmit(0xB3); } //scia_xmit(0x00); while(Hal_sciaGetTxFifoStatus(halHandle) != SCI_FifoStatus_Empty); //while(SCI_txReady(sciaHandle) == 0); //while(SCI_isTxEmpty(sciaHandle) == 0); // inc = 0; usDelay (1000); //GPIO_setLow(gpioHandle, GPIO_Number_18); HAL_setGpioLow(halHandle,GPIO_Number_18); usDelay(50000); if(encoderTipoLeitura == 0) { encoderTipoLeitura = 1; } else { encoderTipoLeitura = 0; usDelay(50000); } // --------------------------------x-------------------------- / -----------------------------SCI------------------------------ interrupt void sciaRxFifoIsr(void) { if(inc < 3) { if(encoderTipoLeitura == 0) { msgRXDec[inc] = Hal_sciaRead(halHandle); } else { msgRXInc[inc] = Hal_sciaRead(halHandle); } inc++; } // Clear Overflow flag HAL_sciaClearRxFifoOvf(halHandle); // Clear Interrupt flag HAL_sciaClearRxFifoInt(halHandle); // Issue PIE ack HAL_pieClearInt(halHandle, PIE_GroupNumber_9); return; } // Transmit a character from the SCI void scia_xmit(int a) { // while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {} while(Hal_sciaGetTxFifoStatus(halHandle) != SCI_FifoStatus_Empty); // SciaRegs.SCITXBUF=a; //SCI_putDataBlocking(sciaHandle, a); HAL_sciaWrite(halHandle, a); //try to use this -maria- // SCI_write(sciaHandle, a); } // ----------------------------- x ------------------------------