Is there any application example on how to use the SPI in slave mode?
How to ensure reliable read/write over SPI in slave mode if transferring an array of data?
Is there any risk that data could be lost because the MCU could be occupied with processing something else (BLE stack processing for example)? Because as I understand it there is no DMA support for the SPI.
Fri, 2014-02-14 16:36
#1
SPI slave mode

嗨乔an,
Can you clarify the slave mode: DA14580 as SPI slave or a peripheral conncected to the DA14580 as SPI slave?
Bluetooth Support Team.
Hi,
I also need to use the DA14580 as a SPI slave but I have some reliability issues. I am trying to assess the SPI as slave and I am not able to send frames without errors during reception.
The documentation is not really explicit when it comes to SPI channel (need to have pull-ups / pull down, maximum speed as slave, etc.). Do you have more information on your side?
Thanks in advance.
Matt
Hi,
We want the DA14580 to act as SPI slave and be the peripheral. So we want another MCU to act as master. But as Matthieu says there is very little documentation on how to setup the chip in slave mode, and when we try to follow the instructions in the datasheet we are not able to get reliable data transfer. Even when we only use the SPI without any BLE enabled...
Best regards
Johan
Dear jojo and Matthieu,
A proper example and documentation for DA14580 as SPI slave will be available in the next SDK release that will be available for download March 28.
Kind regards,
Dialog support
Hello.
I've downloaded test latest SDK from dialog's site ( DA14580_581_SDK_3.0.8.0 ), and even searched the latest beta (DA14580_581_SDK_3.0.10.1) and found no example that setups the SPI as slave ( using SPI_ROLE_SLAVE ).
I might have searched for the wrong keyword - can you please point to the exact project that demonstrates SPI slave capabilities?
Thank you
Koby
Hi kobyfr_mag,
Try the prox_reporter_ext_spi project in the directory dk_apps\keil_projects\proximity\prox_reporter_ext_spi. Hope it helps.
Thanks MT_dialog
Hello,
I'm using the SDK 5.0.3 and tried to figure out too, where the #define SPI_ROLE_SLAVE is in use, but I didn't find any.(!?)
Of course I' found the "\5.0.3\projects\target_apps\ble_examples\prox_reporter_ext_spi", but no application code seems to activate the spi slave mode, nor does any code call the "spi_init()" function with a '1' (slave) in parameter 3 (role).
So my question is: Is the sample application "prox_reporter_ext_spi" really using the SPI-Slave-mode?
Besides: I think it would be worth full to be noted in theDA1488x datasheet, that for using DA14580 in SPI slave mode, the SPI_CLK of the DA1458x, should be set at least be 4x higher than the real SPI clock provided by the spi master.
Hi Ralf S,
Yes the driver isn't used for this kind of project, you can have a look at the spi_hci_slave_init() that does the spi initialization of the 580 in slave mode, which is invoked in the periph_init function.
Thanks MT_dialog
Thank you, I'll check the HCI-Demo as a base for our own SPI Slave-Protocol.
An additional question: The DA14580 datasheet (v3.1) tells for Slave-Mode in register SPI_CTRL_REG (0x50001200) for bit SPI_SMN:
"Master/slave mode
0 = Master,
1 = Slave(SPI1 only"
What is the meaning of SPI1 only?
Hi Ralf S,
The 580, has one SPI module, the "SPI1 only" is a left over from the SPI specification, it doesn't really mean anything, for a system that would have 2 of the same SPI modules only one of the modules would have the capability of being used as a SPI slave but since the 580 has only one this note has no meaning.
Thanks MT_dialog