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 :
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.
解決済! 解決策の投稿を見る。
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.
-------------------------------------------------------------------------------
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
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.
-------------------------------------------------------------------------------