- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For our case, the SPI1 of the wiced module is used as a slave mode.
I have modified wiced_spi_init() to make SPI1 be a slave, and the data sent from master can be received correctly by polling SPI bus.
However, I would like to enable the IRQ of SPI1.
The IRQ is enabled by the following code due to STM32F2xx is used.
SPI_I2S_ITConfig(spi_mapping[spi->port].spi_regs, SPI_I2S_IT_RXNE, ENABLE);
In addition, SPI1_irq() handler is implemented but this ISR is not called while data arriving.
Is there anything missed to enable the SPI IRQ?
Should link files be modified accordingly ?
Solved! Go to Solution.
- Labels:
-
SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The reason is that I forget to configure NVIC for SPI IRQ.
No modification on link file is needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The reason is that I forget to configure NVIC for SPI IRQ.
No modification on link file is needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an issue which may be similar to your case. I am trying to implement SPI slave with transmit only. Clock will be provided by master (in this case I am just running a PWM and connecting it externally to the CLK pin of SPI).
I realized that wiced_spi_init and platform_spi_init functions did not provide the options for slave and single line. Made some modifications to allow for that.
Now I am stuck at spi_transfer function. When not using DMA, the code just gets stuck. And when using DMA, spi_dma_transfer function returns WICED_TIMEOUT.
What am I doing wrong? My application is a simple broadcaster at frequency provided by the clock (38kHz in this case). It can be used for IR communication (one-way, tx only like remotes).
I would really appreciate your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am assuming that slave is to receive data in your case.
Regarding using DMA mode,
you can increase the timeout value temporarily, that I ever tried it.
Then it should get the sent data from host.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The underlying platform is STM32F2xx, which does not support 38kHz clock for SPI.
I would like to transmit data, and since required speed is not supported by the platform, I decided that an external clock could be used and use SPI in slave mode to transmit data.
In platform_spi.c I made a new function which is similar to platform_spi_init but also allows to provide direction and master/slave setting. For example, following is set:
spi_init.SPI_Direction = SPI_Direction_1Line_Tx;
spi_init.SPI_Mode = SPI_Mode_Slave;
After this
SPI_Cmd ( spi->port, ENABLE );
which SETs SPE in CR1 register to initialize the SPI.
I didn't modify the transfer functions and am trying to use the original ones. I am wondering if there is anything additional that needs to be taken care of when using SPI in slave mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DMA Timeout issue resolved for SPI Master mode.
Ref: SPI master and DMA, tested ?
(special thanks to gbrivet)
I will try to tackle the slave issues:
Trying to use the SPI in slave mode to transmit data (TX only) and there is an external clock (generated via wiced_pwm lib connected to CLK pin via jumper).
If suggestions, please share.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Did you modify chip_select code in wiced_spi_init() as below ?
wiced_gpio_init(spi->chip_select, INPUT_HIGH_IMPEDANCE); //we are slave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Discussion is being locked. If you have any follow-up questions, please start a new discussion.