您好, I haven't used DA1458x with external processor configuration, but there is and example in /keil_projects/proximity/reporter_fe/
I think you can select the pin configuration for UART quite freely thanks to GPIO multiplexing. See the file periph_setup.c (in arch folder in the project view in µVision) There you have GPIO_ConfigurePin functions. Above pin configuration, you must also reserve the IO (when developing). This is done with RESERVE_GPIO macro.
你好Vesa, Thanks for the information. My doubt is that can any pin on any port can be used as UART pins? I have same doubt regarding SPI also? Can P1_0, P1_1, P1_2 pins can eb used Serial CLK, Serial data, Serial chip select pins?
UTX进行输出。UART发送数据。映射到PX端口 URX DI输入。UART接收数据。映射到PX端口 URTS DO OUTPUT. UART Request to Send. Mapped on Px ports ucts di输入。UART清楚地发送。映射到PX端口 UTX2进行输出。UART 2传输数据。映射到PX端口 URX2 DI输入。UART 2接收数据。映射到PX端口 urts2做输出。UART 2请求发送。映射到PX端口 UCTS2 DI输入。UART 2明确发送。映射到PX端口
同样适用于SPI总线
SPI_CLK DO INPUT/OUTPUT. SPI Clock. Mapped on Px ports SPI_DI DI输入。SPI数据输入。映射到PX端口 SPI_DO DO OUTPUT. SPI Data output. Mapped on Px ports SPI_EN DI输入。SPI时钟启用。映射到PX端口
See the datasheet for other PIN mappings. Notice that analog interface uses fixed mapping.
你好Vesa, 非常感谢。 现在我明白任何PX引脚都可以配置为SPI接口引脚,提供了在Periph_setup.h文件中适当地初始化引脚。 But as per DA14580 datasheet SPI supports only 8/16/32bit mode transfer, but my slave has a register data of 24bits in size.How to transfer data in this scenario.
I have a slave containing 3differ control registers, as per my SPI slave device datasheet after every spi_write operation I need to wait for 10msec before I do one more spi_write : SPI_WRITE(register1,数据); 延迟(10毫秒); SPI_WRITE(register2,数据); 延迟(10毫秒);
在文件中app_task_handlers.h.,将创建的处理程序函数添加到计时器:{app_event_timer., (ke_msg_func_t)app_event_timer_handler}。If needed, add specific profile include condition.
使用功能ke_timer_set.to set the timer.
清除计时器,使用ke_timer_clear.。
注意:这是内核定时器和它有点李ttle inaccurate always, but I guess it should work. At least, you can try it first.
In the DSPS_0 example in the location --> DSPS_0\DA14580_DSPS_3.150.2\dk_apps\src\plf\refip\src\driver\timer, there is a timer.h file can we use these functions directly to generate microsec delays.
你好Vesan, 谢谢我测试了高达10秒的延迟,它不是如此准确。 我有兴趣知道BLE DA14580是否支持多线程概念? 我的场景是 I have a while(1) loop running, I am registering an IRQ on a GPIO (for a key press event), 因此,如果(1)执行键时,按下键,那么我们应该在循环中突破这一点,而反之亦然(即,再次为Next Keypress,(1)应该开始执行)
But what I observed is that because of while(1) loop, my interrupts are not being executed.
您好,
I haven't used DA1458x with external processor configuration, but there is and example in /keil_projects/proximity/reporter_fe/
I think you can select the pin configuration for UART quite freely thanks to GPIO multiplexing. See the file periph_setup.c (in arch folder in the project view in µVision) There you have GPIO_ConfigurePin functions. Above pin configuration, you must also reserve the IO (when developing). This is done with RESERVE_GPIO macro.
Best Regards, Vesa
你好Vesa,
Thanks for the information.
My doubt is that can any pin on any port can be used as UART pins? I have same doubt regarding SPI also?
Can P1_0, P1_1, P1_2 pins can eb used Serial CLK, Serial data, Serial chip select pins?
是否有任何文档描述了每个PIN可以支持的不同功能?
Thanks
asm.
根据数据表you can use UART on any port (http://support.dialog-seminiondiondiondiondum/resource/da14580-datasheet.,第7页)
同样适用于SPI总线
See the datasheet for other PIN mappings. Notice that analog interface uses fixed mapping.
谢谢!
你好Vesa,
非常感谢。
现在我明白任何PX引脚都可以配置为SPI接口引脚,提供了在Periph_setup.h文件中适当地初始化引脚。
But as per DA14580 datasheet SPI supports only 8/16/32bit mode transfer, but my slave has a register data of 24bits in size.How to transfer data in this scenario.
Thanks
Soujanya.K
嗨soujanya.k,
然后我猜你可以使用8位模式:
setbits16(spi_ctrl_reg,spi_word,spi_mode_8bit);//设置为8位模式
并在三个8位块的块中读取/写入操作:
uint8_t write_buf[] = {0x01, 0x02, 0x03};
const int chunk_size = 24/8;
int c = 0;
while(c < chunk_size)
{
setword16(spi_rx_tx_reg0,* write_buf ++);//写入设备,递增后
do{
}while(GetBits16(SPI_CTRL_REG, SPI_INT_BIT) == 0); // While RX Register is empty
setword16(spi_clear_int_reg,1);//清除spi_int_bit.
C ++;//增量C.
}
这样的东西,我没有测试过!
PS。如果您想同时阅读,您需要做这样的事情,如read_buf = getword16(spi_rx_tx_reg0)&0xff;屏蔽0xff以防以确保没有不需要的数据到达。此方法有点棘手,您需要使用缓冲区......我从不遇到具有SPI块大小的设备24位的设备
I didn't come up with other ideas in short time
你好Vesa,
非常感谢。
Luckily the chip which I am using it doesn't allow for read operations i.e. there is no MISO signal .
所以我只需要执行SPI_WRITE操作。
Thanks
asm.
您好 ,
I have a slave containing 3differ control registers,
as per my SPI slave device datasheet after every spi_write operation I need to wait for 10msec before I do one more spi_write :
SPI_WRITE(register1,数据);
延迟(10毫秒);
SPI_WRITE(register2,数据);
延迟(10毫秒);
如何介绍10毫秒的延迟?
谢谢,
asmaith.
Hello asmaitha,
you could use kernel timers.
APP_MSG
type in fileapp_api.h.to describe your time, e.g.,app_event_timer.
。int timer_handler(ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
。将函数定义添加到标题文件!此函数必须可见文件app_task_handlers.h.{app_event_timer., (ke_msg_func_t)app_event_timer_handler}
。If needed, add specific profile include condition.ke_timer_set.
to set the timer.ke_timer_clear.
。注意:这是内核定时器和它有点李ttle inaccurate always, but I guess it should work. At least, you can try it first.
你好Vesa,
非常感谢你的帮助。
我真的很抱歉,但我了解如何在我的SPI驱动程序文件中定义和调用Timer_Handler。
请您向我指导我一些实施的例子。
In the DSPS_0 example in the location --> DSPS_0\DA14580_DSPS_3.150.2\dk_apps\src\plf\refip\src\driver\timer, there is a timer.h file can we use these functions directly to generate microsec delays.
谢谢,
asmaith.
Hello asmaitha,
是的,似乎你可以使用
timer_wait.
等待最大1000μs或1ms的功能。您需要在标题文件中定义处理程序函数,然后将其包含在SPI驱动程序中。
你好Vesa,
感谢你的信息。
In one of the SDK examples in peripheral_examples :
我找到
for(i = 00; i <20; i ++);该循环介绍了7.6miccro秒的延迟
So can we use this for loop for delays?
Will it be advisable to use this logic?
Thanks
asmaith.
嗨asmaitha,
如果您需要一个非常短的延迟,那么是的,我认为使用它是一个好的。
你好Vesan,
谢谢我测试了高达10秒的延迟,它不是如此准确。
我有兴趣知道BLE DA14580是否支持多线程概念?
我的场景是
I have a while(1) loop running, I am registering an IRQ on a GPIO (for a key press event),
因此,如果(1)执行键时,按下键,那么我们应该在循环中突破这一点,而反之亦然(即,再次为Next Keypress,(1)应该开始执行)
But what I observed is that because of while(1) loop, my interrupts are not being executed.
Any idea how to implement the above logic?
谢谢,
asmaith.
Hello asmaitha,
what do you exactly mean by multithreading? In any case, I suppose it is a matter of OS..
GPIO中断甚至应该工作,即使是在一段时间内(1){}循环,如果已正确配置它们。
如果您使用的是使用SDK,我认为在(1)循环中不应该使用(1)循环。最肯定的是循环将破坏它,你会遇到一些奇怪的问题。
按钮按下的是什么?也许我们可以找到比循环更好的解决方案
你好Vesan,
我有一段时间(1)循环,它一直在将特定数据写入SPI到我的从设备。
我在P0_7上有一个键,所以当我按下键时,它会带来低于10msec的拍摄时间,从而产生中断。
我正在注册中断:
gpio_registercallback(gpio0_irqn,keysweep_callback);
GPIO_EnableIRQ(GPIO_PORT_0, GPIO_PIN_7, GPIO0_IRQn, 1, 1, 10);
Inside my callback :
void keysweep_callback(void)
{
if(key_sweep_status == 1)
Key_sweep_status = 0;
其他
Key_sweep_status = 1;
}
在我的同时(1)
{
if(Key_sweep_status ==1)
/ *是否有关行动* /
其他
打破;
}
但是,我遇到的是,一旦控制进入(1)循环,即使我按下键“keysweep_callback”也没有被调用。
谢谢,
asmaith.