你好, 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.
你好,维萨, 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 DO输出。UART传输数据。映射到Px端口 URX DI输入。UART接收数据。映射到Px端口 URTS DO OUTPUT. UART Request to Send. Mapped on Px ports UCTS DI输入。UART清除发送。映射到Px端口 UTX2 DO输出。UART 2传输数据。映射到Px端口 URX2 DI输入。UART 2接收数据。映射到Px端口 URTS2 DO输出。要发送的UART 2请求。映射到Px端口 UCTS2 DI输入。UART 2清除发送。映射到Px端口
同样适用于SPI总线
SPI_CLK DO INPUT/OUTPUT. SPI Clock. Mapped on Px ports SPI输入。SPI数据输入。映射到Px端口 SPI_DO DO OUTPUT. SPI Data output. Mapped on Px ports SPI\u EN DI输入。SPI时钟启用。映射到Px端口
See the datasheet for other PIN mappings. Notice that analog interface uses fixed mapping.
你好,维萨, 谢谢。 现在我了解到,只要我们在periph\u setup.h文件中适当地初始化这些管脚,任何Px管脚都可以配置为SPI接口管脚。 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\ U写(寄存器1,数据); 延时(10毫秒); spi\ U写(寄存器2,数据); 延时(10毫秒);
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.
你好,维桑, 谢谢,我测试了10秒的延迟,它不是那么准确。 我想知道BLE DA14580是否支持多线程的概念? 我的设想是 I have a while(1) loop running, I am registering an IRQ on a GPIO (for a key press event), 因此,每当按下键时,如果while(1)正在执行,那么我们应该从while循环中断,反之亦然(即,对于下一次再次按下键,while(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
你好,维萨,
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-semiconductor.com/resource/da14580-datasheet,第7页)
同样适用于SPI总线
See the datasheet for other PIN mappings. Notice that analog interface uses fixed mapping.
谢谢!
你好,维萨,
谢谢。
现在我了解到,只要我们在periph\u setup.h文件中适当地初始化这些管脚,任何Px管脚都可以配置为SPI接口管脚。
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
嗨,苏贾尼亚,好的,
我想你可以用8位模式:
SetBits16(SPI_CTRL_REG,SPI_WORD,SPI_MODE_8BIT);//设置为8BIT MODE
并以三个8位块的块进行读/写操作:
uint8_t write_buf[] = {0x01, 0x02, 0x03};
常量int chunk\u 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_位
c++;//增量c
}
像这样的,我还没试过!!
另外,如果您想同时读取,您需要执行如下操作:read\u buf=GetWord16(SPI\u RX\u TX\u REG0)&0xff;用0xff屏蔽,以确保没有不需要的数据到达。这个方法有点棘手,你需要使用缓冲区。。。我从未遇到过SPI块大小为24位的设备
I didn't come up with other ideas in short time
你好,维萨,
谢谢。
Luckily the chip which I am using it doesn't allow for read operations i.e. there is no MISO signal .
所以我只需要执行SPI\u写操作。
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\ U写(寄存器1,数据);
延时(10毫秒);
spi\ U写(寄存器2,数据);
延时(10毫秒);
我怎样才能引入10毫秒的延迟呢?
谢谢,
阿斯梅塔
Hello asmaitha,
you could use kernel timers.
APP_MSG
type in file应用程序api.hto describe your time, e.g.,应用程序事件计时器
.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)
. 将函数定义也添加到头文件中!此函数必须对文件可见应用程序任务处理程序.h{应用程序事件计时器, (ke_msg_func_t)app_event_timer_handler}
.If needed, add specific profile include condition.定时器设置
to set the timer.清除计时器
.注意:这是内核定时器和它有点李ttle inaccurate always, but I guess it should work. At least, you can try it first.
你好,维萨,
非常感谢你的帮助。
我真的很抱歉,但我知道如何定义和调用定时器处理程序在我的spi驱动程序文件。
请你指导我一些实施的例子。
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.
谢谢,
阿斯梅塔
Hello asmaitha,
是的,看来你可以用
计时器\u等待
函数以等待最大1000µs或1ms。您需要在头文件中定义handler函数,然后将其包含在spi驱动程序中。
你好,维萨,
谢谢你的信息。
In one of the SDK examples in peripheral_examples :
我发现了
对于(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
阿斯梅塔
嗨,阿斯梅塔,
如果你需要一个很短的延迟,那么是的,我认为使用它是可以的。
你好,维桑,
谢谢,我测试了10秒的延迟,它不是那么准确。
我想知道BLE DA14580是否支持多线程的概念?
我的设想是
I have a while(1) loop running, I am registering an IRQ on a GPIO (for a key press event),
因此,每当按下键时,如果while(1)正在执行,那么我们应该从while循环中断,反之亦然(即,对于下一次再次按下键,while(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?
谢谢,
阿斯梅塔
Hello asmaitha,
what do you exactly mean by multithreading? In any case, I suppose it is a matter of OS..
即使在while(1){}循环中,如果配置正确,GPIO中断也应该可以工作。
我认为如果您使用的是SDK,就不应该使用while(1)这样的循环。最肯定的是,循环将打破它,你会遇到一些奇怪的问题。
你想用按键来达到什么目的?也许我们能找到比while循环更好的解决方案
你好,维桑,
我有一个while(1)循环,它不断地通过SPI向我的从属设备写入特定的数据。
我在P0\u7上有一个键,所以当我按下这个键时,它会以10毫秒的去抖动周期变低,从而产生一个中断。
我将中断注册为:
GPIO\u RegisterCallback(GPIO0\u IRQn,keysweep\u回调);
GPIO_EnableIRQ(GPIO_PORT_0, GPIO_PIN_7, GPIO0_IRQn, 1, 1, 10);
Inside my callback :
void keysweep\u回调(void)
{
if(键\扫描\状态==1)
Key_sweep_status = 0;
其他的
Key_sweep_status = 1;
}
我的内心(1)
{
if(Key_sweep_status ==1)
/*执行相关操作*/
其他的
中断;
}
但我遇到的是,一旦控制进入while(1)循环,即使我按下“keysweep\u callback”键也不会被调用。
谢谢,
阿斯梅塔