降低DA14695上的SPI CS定时?

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
5个帖子/ 0新
最后一篇
eric_fan.
离线
最后一次露面:4个月3周前
加入:2020-07-14 07:40
降低DA14695上的SPI CS定时?

你好,

我是新的对话框,我使用DA14695和USB DK来研究样品代码(SDK版本:10.0.8.105,WIRA 10.440.8.6)。

我试图使用SPI模块并用LA录制SPI波形,发现CS引脚花了太长。

我的SPI速度是4MHz,CLK时间约为0.25us /位,但CS需要几乎90起,从低到嗨...

时序图如:

CS引脚低----------等40us ---------- 9位数据(总3Us)----------等40us ---------- CS PIN高

有没有办法缩短CS引脚时间以加快SPI?

谢谢!!!

我的SPI写字代码如下所示:

void spi_send_data(uint8_t dat){#if 1 // spi 9位模式ad_spi_activate_cs(spihandle);AD_SPI_WRITE_9TH_BIT(SPIHandle,0x01);spi_send_8b(dat);// ad_spi_deactivate_cs_when_spi_done(spihandle);ad_spi_deactivate_cs(spihandle);#万一 }

关键词:
设备:
lc_dialog
离线
最后一次露面:3周4天前
职员
加入:2016-09-19 23:20
嗨eric_fan,

嗨eric_fan,

我目前正在调查这个问题,很快就会回复你。

请您确认您使用过哪些特定项目。

此致,
lc_dialog

eric_fan.
离线
最后一次露面:4个月3周前
加入:2020-07-14 07:40
你好lc_dialog,

你好lc_dialog,

谢谢你的支持!

我在WIRA_10.440.8.6 SDK中使用“BLE_RANGE_DTE”示例项目,关于SPI移植的一部分位于“ble_peripheral_task”。

SPI初始设置是:

#include“ad_spi.h”/ * spi芯片选择引脚* /静态const ad_io_conf_t spi_master_cs [] = {{.port = custom_device_cs_gpio_port,.pin = custom_device_cs_gpio_pin,.on = {.mode = hw_gpul,.function = hw_gpio_func_spi_en,。high = true},.off = {.mode = hw_gpio_mode_output_push_pull,.function = hw_gpio_func_spi_en,.high = true}},};/ * SPI1 IO * /常量ad_spi_io_conf_t bus_SPI1 = {.spi_do = {.port = SPI1_DO_GPIO_PORT,.pin = SPI1_DO_GPIO_PIN,。对= {HW_GPIO_MODE_OUTPUT_PUSH_PULL,HW_GPIO_FUNC_SPI_DO,FALSE},.off = {HW_GPIO_MODE_INPUT,HW_GPIO_FUNC_GPIO,TRUE},},。SPI_DI = {.port = SPI1_DI_GPIO_PORT,.pin = SPI1_DI_GPIO_PIN,。对= {HW_GPIO_MODE_INPUT,HW_GPIO_FUNC_SPI_DI,FALSE},.off = {HW_GPIO_MODE_INPUT,HW_GPIO_FUNC_GPIO,TRUE},},.spi_clk = {.port = SPI1_CLK_GPIO_PORT,.pin = SPI1_CLK_GPIO_PIN,.on = {hw_gpio_mode_output_push_pull,hw_gpio_func_spi_clk,false},.off = {hw_gpio_mode_input,hw_gpio_func_gpio,true},/ * * spi_master_cs数组中的引脚数。* * \警告SNC \ P CS_CNT使用SPI总线必须始终为1 * / .cs_cnt = 1,.spi_cs = spi_master_cs,.voltage_level = hw_gpio_power_v33 //您可以在此定义所需的电压电平};/ * SPI1总线配置* / SPI_BUS_T SPI1 =&BUS_SPI1;/ *外部传感器/模块SPI驱动程序* / const ad_spi_driver_conf_t drv_spi1 = {.spi = {.cs_pad = {custom_device_cs_gpio_port,custom_device_cs_gpio_pin},.word_mode = hw_spi_word_9bit,//在这里,您可以在这里定义所需的.smn_role = hw_spi_mode_master,.polarity_mode = hw_spi_pol_high,//您可以在这里定义所需的SPI极性.phase_mode = hw_spi_pha_mode_0,//您可以在此处定义所需的SPI阶段.mint_mode = hw_spi_mint_disable,.xtal_freq = hw_spi_freq_div_8,//您可以在此声明您自己的SPI速度.fifo_mode = hw_spi_fifo_rx_tx,.disabled = 0,/ *应在初始化阶段* / .ignore_cs = false禁用,.use_dma = true,.rx_dma_channel = hw_dma_channel_0,.tx_dma_channel = hw_dma_channel_1};/ *传感器/模块设备配置* / const ad_spi_controller_conf_t dev_spi_custom_device = {.id = hw_spi1,.io =&bus_spi1,.drv =&drv_spi1};spi_device spi_custom_device =&dev_spi_custom_device;
的#define SPI1_DO_GPIO_PORT(HW_GPIO_PORT_0)的#define SPI1_DO_GPIO_PIN(HW_GPIO_PIN_26)的#define SPI1_DI_GPIO_PORT(HW_GPIO_PORT_0)的#define SPI1_DI_GPIO_PIN(HW_GPIO_PIN_24)的#define SPI1_CLK_GPIO_PORT(HW_GPIO_PORT_0)的#define SPI1_CLK_GPIO_PIN(HW_GPIO_PIN_21)/ * SPI芯片选择引脚(秒)* /#定义custom_device_cs_gpio_port(hw_gpio_port_0)#define custom_device_cs_gpio_pin(hw_gpio_pin_20)

Kuo41006
离线
最后一次露面:3周2天前
加入:2019-05-20 09:17
你好对话框,

你好对话框,
在我的情况下我有同样的问题。
我的设备使用DA1469X Pro Kit + DA14699子板。

使用PXP_Reporter包括SPI功能。

我使用spi sand一个字节的clk和数据只有50ns,但cs需要5us,如何减少spi cs时序?

使用HW_SPI_WRITE_BUF和AD_SPI_WRITE输出1字节CS TIMEING需要20US和5US。

环境 :

/ * SPI1 IO * /常量ad_spi_io_conf_t bus_SPI1 = {.spi_do = {.port = SPI1_DO_GPIO_PORT,// HW_GPIO_PORT_1 .pin = SPI1_DO_GPIO_PIN,// HW_GPIO_PIN_1。对= {HW_GPIO_MODE_OUTPUT_PUSH_PULL,HW_GPIO_FUNC_SPI_DO,FALSE},.off = {HW_GPIO_MODE_INPUT,HW_GPIO_FUNC_GPIO,真},},.spi_clk = {.port = SPI1_CLK_GPIO_PORT,// HW_GPIO_PORT_1 .pin = SPI1_CLK_GPIO_PIN,// HW_GPIO_PIN_2。对= {HW_GPIO_MODE_OUTPUT_PUSH_PULL,HW_GPIO_FUNC_SPI_CLK,FALSE},.off = {HW_GPIO_MODE_INPUT,HW_GPIO_FUNC_GPIO,TRUE},},/* * spi_master_cs数组中的引脚数。* * \警告SNC \ P CS_CNT使用SPI总线时必须始终为1 * / .cs_cnt = 1,.spi_cs = spi_master_cs,// hw_gpio_port_1 hw_gpio_pin_5 .voltage_level = hw_gpio_power_vdd1v8p //您可以在此处定义所需的电压电平};/ *外部传感器/模块SPI驱动程序* / const ad_spi_driver_conf_t drv_spi1 = {.spi = {.cs_pio_port,custom_device_cs_gpio_pin},.word_mode_cs_gpio_pio_wnet_8bit,//在这里,您可以在这里定义所需的.smn_role = hw_spi_mode_master,.polarity_mode = hw_spi_pol_low,//您可以在这里定义所需的SPI极性.phase_mode = hw_spi_pha_mode_0,//您可以在此处定义所需的SPI阶段.mint_mode = hw_spi_mint_disable,.xtal_freq = hw_spi_freq_div_2,//您可以在此声明您自己的SPI速度32MHz => /2 => 16MHz .fifo_mode = hw_spi_fifo_rx_tx,.disabled = 0,/ *应在初始化阶段* / .ignore_cs = false禁用,.use_dma = true,.rx_dma_channel = hw_dma_channel_0,.tx_dma_channel = hw_dma_channel_1};/ *传感器/模块设备配置* / const ad_spi_controller_conf_t dev_spi_custom_device = {.id = hw_spi1,.io =&bus_spi1,.drv =&drv_spi1};ad_spi_handle_t spi_handle_t;void spi_cmd_write(const uint8_t * wbuf,size_t wlen){hw_gpio_set_inactive(hw_gpio_port_1,hw_gpio_pin_3);ad_spi_activate_cs(spi_handle_t);// cs dc activate // ad_spi_write_async(hw_spi1,wbuf,wlen,null,null);// ad_spi_write(spi_handle_t,wbuf,wlen); hw_spi_write_buf(HW_SPI1,wbuf,wlen,NULL,NULL); ad_spi_deactivate_cs_when_spi_done(SPI_handle_t); hw_gpio_set_active(HW_GPIO_PORT_1, HW_GPIO_PIN_3); // CS DC release } void SPI_TEST_task(void *params) { ad_spi_init(); SPI_handle_t = ad_spi_open((ad_spi_controller_conf_t *)SPI_CUSTOM_DEVICE); //ad_spi_deactivate_cs(SPI_handle_t); hw_gpio_set_inactive(HW_GPIO_PORT_1, HW_GPIO_PIN_4); OS_DELAY_MS(110); hw_gpio_set_active(HW_GPIO_PORT_1, HW_GPIO_PIN_4); printf("\n\reset_end \n\r"); OS_DELAY_MS(200); // ad_spi_activate_cs(SPI_handle_t); a[0]=1; SPI_CMD_WRITE(a,1); /* ad_spi_activate_cs(SPI_handle_t); hw_gpio_set_inactive(HW_GPIO_PORT_1, HW_GPIO_PIN_3); ad_spi_write(SPI_handle_t,a,1); ad_spi_deactivate_cs_when_spi_done(SPI_handle_t); hw_gpio_set_active(HW_GPIO_PORT_1, HW_GPIO_PIN_3); */ while(1) { OS_DELAY_MS(500); printf("\n\r in while loop \n\r"); } }

FIFO_MODE设置
我只需要SPI数据到LCD(4行)
但是,当我更改SPI设置时.fifo_mode = hw_spi_fifo_rx_tx,=> hw_spi_fifo_tx_only,始终在assert_warning中运行((cfg-> fifo_mode == hw_spi_fifo_rx_tx)||
(cfg-> fifo_mode == hw_spi_fifo_none)));

极性_Mode设置

我更改hw_spi_pol_low => hw_spi_pol_high
在逻辑分析仪中,只需提取CLK引脚数据引脚不是。

谢谢!!!

附件:
PM_DIALOG.
离线
最后一次露面:2天4小时前
职员
加入:2018-02-08 11:03
嗨Kuo41006,

嗨Kuo41006,

道歉 - 可能是我错过了你的评论。让我检查一下,我会回复你。

与此同时,你检查了吗?DA1469X教程SPI适配器概念教程?

如果您可以通过问题培养新的论坛机票,这将是非常有帮助的。

谢谢,PM_DIALOG.