Hi,
I'm using a LPIT timer to trigger the reading and writing of data to my ICs through SPI & I2C. Before, that was done in an infinite loop in the main function but as soon as I paste it in the LPIT trigger function I am always reading STATUS_BUSY with the LPSPI_DRV_MasterGetTransferStatus() function. Did you had this problem before ?
void LPIT0_Ch1_ISR(void){
LPIT_DRV_ClearInterruptFlagTimerChannels(INST_LPIT0, 1<<LPIT0_CHANNEL1);
uint8_t spi_data_receive[2];
hall_singleRead(LPSPICOM0, (uint8_t *)(&UART_command_param.sys_param.spi_read_address), (uint8_t *)(&spi_data_receive), 2);
MAX5215_setOutput(INST_LPI2C0, &UART_command_param);
ADC_readConversion(INST_LPI2C0, &UART_command_param);
enableBuck(&UART_command_param);
UART_command_param.sys_param.spi_read_value[0] = spi_data_receive[0];
UART_command_param.sys_param.spi_read_value[1] = spi_data_receive[1];
}
void hall_singleRead(uint32_t instance, uint8_t * sendBuffer, uint8_t * receiveBuffer, uint16_t transferByteCount){
LPSPI_DRV_MasterTransfer(instance, sendBuffer, NULL, transferByteCount);
while(LPSPI_DRV_MasterGetTransferStatus(instance, NULL)==STATUS_BUSY){};
LPSPI_DRV_MasterTransfer(instance, NULL, receiveBuffer, transferByteCount);
while(LPSPI_DRV_MasterGetTransferStatus(instance, NULL)==STATUS_BUSY){};
}
Hi,
try to increase interrupt priority for LPSPI.
BR, Petr