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.

When the program is downloaded to flash, SCI can't work properly

I met a strange issue:

When online debugging,28069 SCI communication is normal.

 When the program is downloaded to the chip flash, SCI is not working properly.

The following is the SCI initialization code:

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

	SCI_setMode(obj->sciBHandle,SCI_Mode_IdleLine);            
	SCI_setCharLength(obj->sciBHandle,SCI_CharLength_8_Bits);  
	SCI_setNumStopBits(obj->sciBHandle,SCI_NumStopBits_One);   
	SCI_setParity(obj->sciBHandle, SCI_Parity_Odd);
	SCI_disableParity(obj->sciBHandle);                       
	SCI_disableLoopBack(obj->sciBHandle);                     

	SCI_disableRxErrorInt(obj->sciBHandle);                    
	SCI_disable(obj->sciBHandle);
	SCI_disableTxWake(obj->sciBHandle);                       
	SCI_disableSleep(obj->sciBHandle);                         
	SCI_enableTx(obj->sciBHandle);                            
	SCI_enableRx(obj->sciBHandle);                             

	SCI_setBaudRate(obj->sciBHandle,SCI_BaudRate_9_6_kBaud); 
	SCI_clearRxFifoInt(obj->sciBHandle);                      
	SCI_enableRxInt(obj->sciBHandle);                        
	SCI_enableTxInt(obj->sciBHandle);                     
	SCI_enable(obj->sciBHandle);

	SCI_resetRxFifo(obj->sciBHandle);
	SCI_resetTxFifo(obj->sciBHandle);
	return;
}  // end of HAL_setupSciB() function

GPIO_setMode(obj->gpioHandle,GPIO_Number_40,GPIO_40_Mode_SCITXDB); GPIO_setMode(obj->gpioHandle,GPIO_Number_41,GPIO_41_Mode_SCIRXDB);

//! \brief Defines the base address of the serial communications interface (SCI) B registers //! #define SCIB_BASE_ADDR (0x00007750) // initialize the SCIB handle obj->sciBHandle = SCI_init((void *)SCIB_BASE_ADDR,sizeof(SCI_Obj));

  • Stefan,

    does the clock settings change between both the use cases? if the system clock is different then the baud rate has to be re-calculated accordingly.

    Best Regards

    Santosh Athuru

  • Stefan Du said:
     When the program is downloaded to the chip flash, SCI is not working properly.

    Stefan,

    also can you let us know if by above you mean, after you program flash the SCI is not working but rest of the code is working? Also does the problem happen after you power OFF/ON the board or immediately after flash is programmed?

    Best Regards
    Santosh Athuru

  • Stefan,

    What is the issue? Did you notice any RX errors?

    Are the SCI ISRs getting executed from Flash or RAM?
    If the ISRs are in Flash, then as you might know, wait-states will be incurred in fetching the ISRs from Flash and this can change the rate at which the SCITXBUF gets written and the SCIRXBUF gets read compared to that of RAM execution. This does not affect the baud rate but the space between the data blocks can differ in the transmit for example. During receive, overflow can occur if the RXBUF is not read quick enough. You can avoid overflow by designing a good protocol between the transmitter and receiver making sure that the transmitter sends data only when the receiver acknowledges that the data is received.

    Thanks and regards,
    Vamsi