Hello,
I'm trying to configure a SPI Slave module with a interrupt on receive. I saw it's a common topic here but I couldn't find any answere to help me.
My code is really simple, I'm using a SPI master to generate signal to a SPI Slave. I put a LED to turn on when the SPI Slave receve something. If I do it, I can complete the rest. The code is:
DigitalOut ledDbg( LED4 ) ;
extern "C" static void execute_spi_slave_hw( void )
{
ledDbg = 1;
}
The object is a global variable created with this line:
SPISlave dev_spi_slave( MOD_SPI_SLAVE_MOSI, MOD_SPI_SLAVE_MISO , MOD_SPI_SLAVE_SCK , MOD_SPI_SLAVE_SS ) ;
And the configuration of SPI Slave Interrupt is:
dev_spi_slave.format( 8 , 0 ) ;
NVIC_SetVector( SPI_IRQn , ( uint32_t ) execute_spi_slave_hw ) ;
NVIC_SetPriority( SPI_IRQn , 2 ) ;
NVIC_EnableIRQ( SSP1_IRQn ) ;
dev_spi_slave.reply( ( int ) 0x3C ) ;
I know that I have data because my SPI Master receive the 0x3C, but the interrupt function never run.
What I'm doing wrong?
Thanks everyone.
Hello,
I'm trying to configure a SPI Slave module with a interrupt on receive. I saw it's a common topic here but I couldn't find any answere to help me.
My code is really simple, I'm using a SPI master to generate signal to a SPI Slave. I put a LED to turn on when the SPI Slave receve something. If I do it, I can complete the rest. The code is:
DigitalOut ledDbg( LED4 ) ;
extern "C" static void execute_spi_slave_hw( void ) { ledDbg = 1; }
The object is a global variable created with this line:
SPISlave dev_spi_slave( MOD_SPI_SLAVE_MOSI, MOD_SPI_SLAVE_MISO , MOD_SPI_SLAVE_SCK , MOD_SPI_SLAVE_SS ) ;
And the configuration of SPI Slave Interrupt is:
dev_spi_slave.format( 8 , 0 ) ; NVIC_SetVector( SPI_IRQn , ( uint32_t ) execute_spi_slave_hw ) ; NVIC_SetPriority( SPI_IRQn , 2 ) ; NVIC_EnableIRQ( SSP1_IRQn ) ; dev_spi_slave.reply( ( int ) 0x3C ) ;
I know that I have data because my SPI Master receive the 0x3C, but the interrupt function never run. What I'm doing wrong?
Thanks everyone.