cancel
Showing results for 
Search instead for 
Did you mean: 

Slave SPI Receive Only Interrupt

Smoun.1
Associate III

Hi

I have (had) a working project with an EXT interrupt which was wired to the CS pin of a SPI bus.

Although it was working I had various bugs, particularly a timer interrupt, which TDK helped me resolve earlier.

I've had great success with SPI master, full duplex on another project, so I thought I would try the Hardware NSS combined with interrupt on that SPI port.

Here's what I'm doing - probably not the best way:

inside my timer interrupt callback:

if (htim->Instance == TIM2) {
	HAL_GPIO_TogglePin(RUNLED_GPIO_Port, RUNLED_Pin);
	if (SPI_Flag == 0) {
		if (HAL_SPI_Receive_IT(&hspi1, (uint8_t*)(&h743_spi_rx_), 6) != HAL_OK) {
			Error_Handler();
		}
	}

And I'm using this callback:

void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)

It does the job fine, however, it only does it once.

Note the Flag I have in the timer interrupt, this is to make sure I dont accidentally call another SPI IT if I have already one pending.

I was doing some digging online and found people saying the IRQ needs to be cleared. It mostly applied to DMA stuff. I wonder if it might my problem here?

Cheers

0 REPLIES 0