Component documentation - Typical Usage
#define BLOCK_SIZE 4 uint8_t OutData[BLOCK_SIZE] = "0123"; uint8_t InpData[BLOCK_SIZE]; volatile LDD_SPIMASTER_TError ComError = 0U; LDD_TError Error; LDD_TDeviceData *MySPIPtr; void main(void) { ... MySPIPtr = SM1_Init(NULL); /* Initialization of SM1 component */ SM1_SelectConfiguration(MySPIPtr, 1U, 1U); /* Select chip select 1 and attribute set 1 */ Error = SM1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */ Error = SM1_SendBlock(MySPIPtr, OutData, BLOCK_SIZE); /* Start transmission/reception */ while (!SM1_GetBlockReceivedStatus(MySPIPtr)) { /* Wait until data block is transmitted/received */ SM1_Main(MySPIPtr); } SM1_SelectConfiguration(MySPIPtr, 0U, 0U); /* Select chip select 0 and attribute set 0 */ Error = SM1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */ Error = SM1_SendBlock(MySPIPtr, OutData, BLOCK_SIZE); /* Start transmission/reception */ while (!SM1_GetBlockReceivedStatus(MySPIPtr)) { /* Wait until data block is transmitted/received */ SM1_Main(MySPIPtr); } } Content of Event.c: extern volatile LDD_SPIMASTER_TError ComError; extern LDD_TError Error; extern LDD_TDeviceData *MySPIPtr; void SM1_OnError(LDD_TUserData *UserDataPtr) { Error = SM1_GetError(MySPIPtr, (LDD_SPIMASTER_TError *)&ComError); /* Get communication errors if occured */ } |
Why SM1_OnError and SM1_GetError not generate?
According to the routine, did not achieve the expected function, how to solve?
Hi bincheng,
Please check if you have enabled the Interrupt service/event.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I use KDS software, but the interface is different from yours.
You can switch Tab views:
Why is my software just not working?
Did you have enabled the Interrupt service/event?