Should I disable system sleep when DA14580 acting as spi slave is receiving or transmitting ?

⚠️
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.
9个帖子/ 0新
Last post
CGHA.
Offline
最后一次露面:5 months 2 weeks ago
Joined:2016-03-23 13:05
Should I disable system sleep when DA14580 acting as spi slave is receiving or transmitting ?

我想实现da14580 spi的奴隶,和use additional 2 pins for transfer flow control, 1pin for master to slave data irq(M2S_irq_pin) and 1pin for slave to master irq(S2M_sync_pin). Master or slave can start spi transfer at anytime. When Master to slave irq assert, it should wait the slave S2M_sync_pin assert to indicate the slave is ready to receive data.

1. Should I call arch_disable_sleep() when I have inited the da14580 spi as slave and waiting for the spi master to start SPI transfer, and call arch_set_extended_sleep() when the transfer has finished?

2. Does the wkupct_enable_irq works at anytime? Can the pin assigned to wakeup generate interrupt at any time(when the system is in sleep, idle ,active mode), ? Since when the spi master want to transfer data to da14580(assert M2S_irq), it does not know whether the da14580 is in active mode or sleep mode, but the slave should prepare for the spi data transfer at anytime when the spi master assert the m2s_irq_pin.

3. Should I enable the EXTERNAL_WAKEUP preprocessor since the M2S_irq_pin will wake the DA14580?

Device:
PM_DIALOG.
Offline
最后一次露面:4 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi cgha,

Hi cgha,

Thanks for your inquiry online. To be honest, I am not completely sure what you are you trying to accomplish. As far as I understand, you want to configure the DA14580 as SPI slave and wake it up through M2S_irq_pin? Be aware that when the device is in sleep mode, all the peripherals blocks are powered down, so the chip should operate n active mode. If you use the wake-up controller in order to catch the M2S_irq, this will work at any time. However, it would be very helpful to provide me more inputs for what you are doing.

谢谢,PM_DIALOG.

CGHA.
Offline
最后一次露面:5 months 2 weeks ago
Joined:2016-03-23 13:05
是的,我想使用m2s

是的,我想使用m2s_irq_pin to wakeup the DA14580 when the spi master want to send data via spi(whether if the DA14580 is in sleep mode or active mode),when DA14580 is ready to receive data, it ack the external mcu with the S2M_irq_pin active, then the external mcu send data. The process is as following:

DA14580 is advertising or disconnected with no advertising or connected, app running with deep sleep enabled or ext sleep enabled:

1. SPI_MASTER(external mcu) want to send data, put the M2S_irq_pin high.

2. SPI_SLAVE(DA14580)通过M2S_IRQ_PIN获取引脚中断

3. SPI_SLAVE initialize it self as spi_slave and ack S2M_irq_pin with high.

4. SPI_MASTER检查S2M_IRQ_PIN,在S2M_IRQ_PIN上检测高电平,然后将SPI数据发送到DA14580。

5.数据传输完成后,SPI_MASTER将M2S_IRQ_PIN LOW放置。

6. SPI_SLAVE将S2M_IRQ_PIN LOW。

CGHA.
Offline
最后一次露面:5 months 2 weeks ago
Joined:2016-03-23 13:05
Now I can only get the first

现在我只能获得第一个引脚中断并获得第一个数据包,当SPI母版想要发送第二数据包时,DA14580似乎无法再次获得引脚中断。

PM_DIALOG.
Offline
最后一次露面:4 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi cgha,

Hi cgha,

由于您发送第二个中断,请您可以在唤醒控制器回调函数中添加断点,以检查是否匹配?要配置唤醒引脚,请查看SDK>的BLE_APP_SLEEPMODE示例>您是否使用了相同的代码架构?

谢谢,PM_DIALOG.

CGHA.
Offline
最后一次露面:5 months 2 weeks ago
Joined:2016-03-23 13:05
不,它无法进入

现在它可以输入回调。在PIN再次高度后,我应该调用INT_ENABLE函数。但是,在发送数十个数据包后,SPI丢失了一些字节。SPI_Handler似乎无法快速获得字节。主速度约为250k bps。

void SPI_Handler(void) { if(packetLen ==13 && spiIsInited) { //GLOBAL_INT_DISABLE(); while(packetLen) { while(0xFF&GetBits16(SPI_CTRL_REG,SPI_INT_BIT)) { while (GetBits16(SPI_CTRL_REG,SPI_TXH)==1); SetWord16(SPI_RX_TX_REG0,*p_spi_txdata++); //p_spi_txdata ++; *p_spi_rxdata++ = 0xFF&GetWord16(SPI_RX_TX_REG0); SetWord16(SPI_CLEAR_INT_REG, 0x01); if(packetLen){ packetLen --; if(packetLen == 0) { SPI_Transfer_IRQ_Off(); newPacket = 1; rcvedCnt++; } } } } //GLOBAL_INT_RESTORE(); } }

PM_DIALOG.
Offline
最后一次露面:4 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi cgha,

Hi cgha,

To be honest, I could not understand how you would like to wake-up you device upon M2S_irq_pin interrupt detection. Did you configure the wake-up controller? Only the wake-up controller can wake-up the chip.

谢谢,PM_DIALOG.

CGHA.
Offline
最后一次露面:5 months 2 weeks ago
Joined:2016-03-23 13:05
现在它有效,所以我需要

Now the wakeup works, So do I need to call arch_disable_sleep() when the spi is transfering? Or should I keep the ble on when spi is transfering?

PM_DIALOG.
Offline
最后一次露面:4 hours 15 min ago
Staff
Joined:2018-02-08 11:03
Hi cgha,

Hi cgha,

The arch_disable_sleep() disables all sleep modes, so the system operates in active / idle modes only. The DA14580 has 2 sleep modes available:

EXTENDED sleep mode: Only the SystemRAM 42kB & RetentionRAM remain switched on.

DEEP sleep mode: Only the RetentionRAM remains switched on. The OTP must be burnt to be able to measure the DEEP sleep current.

In both of the sleep modes, all the peripheral blocks including the SPI block and the RF block are powered off, so I would suggest to keep the device in active mode while interacting with the SPI block.

谢谢,PM_DIALOG.