⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
vengatesan
Offline
Last seen:3 years 1 month ago
加入:2017-09-20 12:44
spi_slave example

spi_config spiconfig = {CS_PORT CS_PIN,HW_SPI_WORD_8BIT,HW_SPI_MODE_SLAVE,HW_SPI_POL_LOW,HW_SPI_PHA_MODE_0,HW_SPI_MINT_ENABLE,HW_SPI_FREQ_DIV_14,HW_SPI_FIFO_RX_TX,1};

hw_spi_init(HW_SPI1,&spiconfig);
hw_spi_enable_interrupt(HW_SPI1);
hw_spi_enable(HW_SPI1,1);

Is this correct way to set SPI configuration?because after this configuration, sent data not trigger SPI_Interrupt_Handler(HW_SPI1)?

Is there any application example on how to use the SPI in slave mode?

Device:
MT_dialog
Offline
Last seen:3 months 14 hours ago
工作人员
加入:2015-06-08 11:34
Hi vengatesan,

Hi vengatesan,

This forum category is related to the thread, please use the Bluetooth categories in order to post additional questions regarding BLE.

The 68x isn't usually used as a slave device when operating over SPI (there is an example in the peripherals demo using SPI as a slave over the adapters, but it isn't fully functional), this is the only example in the SDK using the 68x SDK over SPI slave mode (there is no adapters implementation for operating in that mode), so you will have to modify the code in order for the device to operate as an SPI slave. In the implementation that you have described the reason the the SPI interrupt doesn't occur is because you have not enabled the NVIC for that paricular interrupt, as soon as you do so, the interrupt will occur (NVIC_EnableIRQ(SPI_IRQn);). Also instead of actually calling the enabling of the NVIC you can invoke the hw_spi_read_buf() function which will take care of the additional SPI configurations as well.

Thanks MT_dialog