Bus Fault happen when reading LPSPI receive data register(RDR)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bus Fault happen when reading LPSPI receive data register(RDR)

1,571 Views
Jason_yuchengjie
Contributor I

Hi guys

I was trying to read SBC's status register(UGA1169TK) via LPSPI1 with S32K146 EVB. Actually it's a example code in S32K1xx Series Cookbook. But when reading the data from Receive Data Register(RDR), an error happened and program jumped to DefaultISR. The code and error information as below.

Code:

uint16_t LPSPI1_receive_16bits (void)
{
uint16_t recieve = 0;

while((LPSPI1->SR & LPSPI_SR_RDF_MASK) >>LPSPI_SR_RDF_SHIFT==0);
/* Wait at least one RxFIFO entry */
recieve = LPSPI1->RDR; /* Read received data */ /* Error happens here */
LPSPI1->SR |= LPSPI_SR_RDF_MASK; /* Clear RDF flag */
return recieve; /* Return received data */
}

When error happens program jumps to below.

DefaultISR:
b DefaultISR
.size DefaultISR, . - DefaultISR

 

Debugger console information:

Target has been RESET and is active.
BusFault: A precise (synchronous) data access error has occurred.
Possible BusFault location: 0x4002C074.
HardFault: A fault has been escalated to a hard fault.

 

Please help to confirm what reason caused this error? Thank you.

0 Kudos
Reply
2 Replies

1,506 Views
byreddy1245367
Contributor I

I strongly suggest following these steps tellpopeyess 

 

if that doesn't work try this greatpeopleme 

0 Kudos
Reply

1,538 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

 

I suggest you refer to the SDK v4 examples in the S32DS https://www.nxp.com/design/software/development-software/s32-design-studio-ide/s32-design-studio-for...

You can replicate the test with this example to see if the problem still persists.

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

0 Kudos
Reply