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.
About safety function ID[SPI 10] in target file.
With regard to this monitoring,
by fault injection by the following procedure,
"1" is set in the corresponding bit of the register,
and i think that fault detection can be realized.
But the corresponding bit is not set.
Can you answer the following two questions?
· Is there something wrong with my fault insertion method and monitoring method?
· Other, please be careful.
<Procedure>
1. Set "1" to bits 9 and 11 of IOLPBKTSTCR register
(Loopback test Enable, digital mode)
2. Set "1" to CTRL TIMEOUT bit of IOLPBKTSTCR register
(Process to intentionally generate Timeout error)
3. Monitor "TIMEOUTERRFLG" of SPIFLG register
⇒, but PARITYERRFLG is not at all.
4. Set "0xFFFFF03C" to IOLPBKTSTCR register Set
(Loopback test Disable)
* For the step 1 in the above procedure, we also try in the following 2 modes.
However, we can not capture the state where the error flag is set.
-> Set "1" to bits 1, 9, 11 of IOLPBKTSTCR register
(Loopback test Enable, analog Tx mode)
-> Set "1" to bits 0, 1, 9, 11 of the IOLPBKTSTCR register
(Loopback test Enable, analog Rx mode)
Now, i am testing fault injection in 3 modes.
Please tell me if the correct execution mode of this function is decided.
Hello Falcon,
I generated this timeout error on my bench test. This is my test code:
int main(void)
{
/* USER CODE BEGIN (3) */
volatile uint32 SpiBuf, blocksize, i;
spiDAT1_t dataconfig1_t;
dataconfig1_t.CS_HOLD = FALSE;
dataconfig1_t.WDEL = TRUE;
dataconfig1_t.DFSEL = SPI_FMT_0;
dataconfig1_t.CSNR = 0xFE;
uint32 Chip_Select_Hold = (dataconfig1_t.CS_HOLD) ? 0x10000000U : 0U;
uint32 WDelay = (dataconfig1_t.WDEL) ? 0x04000000U : 0U;
SPIDATAFMT_t DataFormat = dataconfig1_t.DFSEL;
uint8 ChipSelect = dataconfig1_t.CSNR;
/* Enable CPU Interrupt through CPSR */
_enable_IRQ();
/* Initialize SPI Module Based on GUI configuration
* */
spiInit();
adcInit();
adcCalibration(adcREG1);
/* - enabling loopback ( this is to emulate data transfer without external wires */
// spiEnableLoopback(spiREG3, Digital_Lbk);
spiEnableLoopback(spiREG3, Analog_Lbk);
// spiREG3->IOLPKTSTCR |= (1 << 0); //Analog loopback through the receive pin.
spiREG3->IOLPKTSTCR &= (0xFFFFFFFE); //Analog loopback through the TX pin.
//Disable SPI3 TX/RX Interrupts
spiDisableNotification(spiREG3, 0x300);
blocksize = 16;
i = 0;
while(blocksize != 0U)
{
if(blocksize == 1U)
{
Chip_Select_Hold = 0U;
}
spiREG3->IOLPKTSTCR |= ( 1 << 17); //induce error: CTRL_TIMEOUT -- flg=0x0201, SPIBUF=0x810E0000 (RX !=TX) -- DLENERR
// spiREG3->IOLPKTSTCR |= ( 1 << 16); //induce error: CTRL_DLENERR flg=0x0201; SPIBUF=0x810E0000 (RX !=TX) -- DLENERR
// spiREG3->IOLPKTSTCR |= ( 1 << 18); //induce error: CTRL_PARERR flg=0x0304; SPIBUF=0x040E0011 (RX=TX) -- PARITYERR
// spiREG3->IOLPKTSTCR |= ( 1 << 19); //induce error: CTRL_DESYNC flg=0x0300; SPIBUF=0x000E0011 (RX=TX) -- No Error
// spiREG3->IOLPKTSTCR |= ( 1 << 20); //induce error: CTRL_CTRLBITERR flg=0x0310; SPIBUF=0x100E0011 (RX=TX) --BITERR
// spiREG3->IOLPKTSTCR |= ( 1 << 2); //enable error to CSx: CTRL_SCS_PIN_ERR
// spiREG3->IOLPKTSTCR |= ( 0 << 3); //induce error: ERR_SCS_PIN; flag is set
spiREG3->DAT1 = ((uint32)DataFormat << 24U) |
((uint32)ChipSelect << 16U) |
(WDelay) |
(Chip_Select_Hold) |
(uint32)TX_Data[i];
/*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */
while((spiREG3->FLG & 0x00000100U) != 0x00000100U)
{
} /* Wait */
SpiBuf = spiREG3->BUF;
RX_Data[i] = SpiBuf;
/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
i++;
blocksize--;
}
while(1);
/* USER CODE END */
return 0;
}