2024-11-08 03:34 PM
I am trying to make a very simple SPI ISR to read the RXDR and store the value to a buffer. However, I cannot get the ISR to even trigger without using HAL_SPI_Receive_IT(). I do not want to use the callbacks or the default IRQ generated by cube. I currently just have the following in my ISR:
void spiISR(SPI_HandleTypeDef *hspi){
if (__HAL_SPI_GET_FLAG(&hspi1, SPI_FLAG_RXNE)) {
rxBuffer[rxIndex] = SPI1->RXDR;
// Increment index and wrap around if necessary
rxIndex = (rxIndex + 1) % RX_BUFFER_SIZE;
__HAL_SPI_CLEAR_OVRFLAG(&hspi1);
}
}
Since I don't want to use the generated IRQ I do this:
void SPI1_IRQHandler(void)
{
/* USER CODE BEGIN SPI1_IRQn 0 */
spiISR(&hspi1);
return;
/* USER CODE END SPI1_IRQn 0 */
HAL_SPI_IRQHandler(&hspi1);
/* USER CODE BEGIN SPI1_IRQn 1 */
/* USER CODE END SPI1_IRQn 1 */
}
I have turned on the following:
MX_SPI1_Init();
/* USER CODE BEGIN 2 */
HAL_NVIC_EnableIRQ(SPI1_IRQn);
__HAL_SPI_ENABLE_IT(&hspi1, SPI_IT_RXNE);
This would leave me to believe that the ISR should trigger when the fifo is not empty; however that is not the case.
I have ensured data is being transferred to the board on an oscilloscope, but the board shows no indication of receiving data
2024-11-09 10:44 AM
Have you configured the SPI? Show the code.