LPSI LPSPI_DRV_MasterTransferBlocking [HardFault]

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPSI LPSPI_DRV_MasterTransferBlocking [HardFault]

ソリューションへジャンプ
925件の閲覧回数
Kazarian
Contributor II

Hello,

im trying to iniitialise the SBC for a CAN comunication between S32k148 and TLE9263.

the controller is set as a master with the following config :

Kazarian_0-1652354992605.png

Kazarian_1-1652355023021.png

 

the initialisation is done successfuly

 

status_t status = LPSPI_DRV_MasterInit(SBCSPICOM1,&sbcSpiCom1State,&sbcSpiCom1_MasterConfig0);
INT_SYS_SetPriority(LPSPI1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);

 

when i want to send data (2 byte )

 

BspReturnCode Sbc_TransferSPICommand(uint8_t txAddr, uint8_t txData, uint8_t *rxStatusInf, uint8_t *rxData)
{
	uint8_t txBuffer[2];
	uint8_t rxBuffer[2];
	txBuffer[0]=txAddr;
	txBuffer[1]=txData;

     /* Try to execute Write SPI function */

     status_t status = LPSPI_DRV_MasterTransferBlocking(SBCSPICOM1, (uint8_t *)txBuffer, (uint8_t *)rxBuffer,2U,10000U);

     if(status != STATUS_SUCCESS){
    	 	return BSP_ERROR;
     }
     else{
    	 *rxStatusInf=rxBuffer[0];
    	 *rxData=rxBuffer[1];
    	  return BSP_OK;
     }
 }

 

i got an exception in the lpspi_master_driver.c function LPSPI_DRV_MasterTransferBlocking(...)

 

 

    /* As this is a synchronous transfer, wait until the transfer is complete.*/
    osifError = OSIF_SemaWait(&(lpspiState->lpspiSemaphore), timeout);

 

 

seems the transfere is never finished ?

Thank you.

0 件の賞賛
1 解決策
902件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Kazarian,

I think you have the same problem as on this thread: https://community.nxp.com/thread/497317
"As the driver uses FreeRTOS API, the driver must be initialized and used inside a FreeRTOS task after the scheduler is started."

Hope it helps.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
2 返答(返信)
913件の閲覧回数
Kazarian
Contributor II

This is a bit strange...

i use Freertos and i do the SBC initialisation in the board_init(void) function, if i do it here i get this HardFaultError.

but when i move the SBC initialisation into a task its performed correctly ?

here is the rtos config 

 

Kazarian_0-1652370661382.png

 

0 件の賞賛
903件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Kazarian,

I think you have the same problem as on this thread: https://community.nxp.com/thread/497317
"As the driver uses FreeRTOS API, the driver must be initialized and used inside a FreeRTOS task after the scheduler is started."

Hope it helps.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛