将IoT MultiSensor移植到ISM14585模块

⚠️
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.
11 posts / 0 new
Last post
gme_johannes
Offline
Last seen:3周2天前
加入:2017-12-22 10:09
将IoT MultiSensor移植到ISM14585模块

亲爱的对话支持,

我们正在使用新的Inventek ISM14585模块。我们希望使用BMI160(稍后添加BMM150)将MSK固件端口移植到此模块。在MultiSensor DK上,我已成功用BMI160替换了ACC / Gyro并获得运行。

Now I have some trouble porting the firmware.

Observations:

(1)我不得不undef USE_SPI_FLASH_CONFIG,否则I got a hard fault (waiting for SPI to read the flash). I don't know what the problem could be. The internal flash of ISM14585 is a GigaDevice GD25D series.

(2)我已经停用了大多数env的例程。在代码中的传感器和磁力计。当我启动固件时,并与IOT应用程序连接,UART显示以下内容:

========IoT+ STARTED======== INFO: Sensors Initilization INFO: Sensors Suspend INFO: Adv Started, value:160 INFO: IoT+ Connected INFO: Sensors Initilization INFO: Sensors Suspend INFO: DWS cmd: 21 INFO: DWS cmd: 22 INFO: DWS cmd: 11 INFO: DWS cmd: 1 INFO: Sensors Started INFO: DWS cmd: 17 INFO: DWS cmd: 13 INFO: DWS cmd: 20 INFO: DWS cmd: 26

After this, nothing happens. The app does not show any sensor data.

Findings:

(a)我测量的是,BMI160中断不断高,似乎DRDY中断不起作用。
除此之外,我看到CS,CLK,MISO,MOSI没有任何异常。

(b)在UM-B-101中,附录A,我发现MultiSensor DK实际上使用了处理某些配置步骤的二级引导加载程序;但是,我对BMI160对此至关重要,这对BMI160至关重要(而且它对原来的ACC / Gyro做了一些配置)。
在ISM14585中,OTP用辅助引导加载程序刻录,因为内部闪存CS被映射到P0_7而不是P0_3(因此它不会在没有此的DEV模式下启动)。

My Questions:

(1) What can be the reason that I don't see the interrupt from BMI160 going low?
(2)是必要的特殊二级引导程序吗?我可以通过将生成的十六进制文件闪烁到闪存中来端口固件吗?

非常感激你的帮助。

BR Johannes.

设备:
MHv_Dialog
Offline
Last seen:2个月4周前
Staff
加入:2013-12-06 15:10
Hi Johannes,

Hi Johannes,

请告诉我哪个GPIO连接到BMI160,所以我可以在我身边运行它。

  1. Obviously all initialization of the BMI160 as well as the GPIO mapping will have to be correct for this to work
  2. 辅助引导加载程序不是必需的。可以指定通过OTP标题的寄存器引导所需的GPIO。您可以刷生效的十六进制文件(实际上smartsnippets工具箱将首先将其转换为二进制文件)指向闪存。您必须在SmartSnippets工具箱中设置SPI GPIO,以指定P0_7是SPI CS。

我不是使用传感器物联网标记固件作为应用程序的起点的大粉丝。你将留下很多一半的支持代码,最终会咬你。更好的方法是使用extent_peripheral_template项目并慢慢将代码移动到该项目中。

/ mhv.

gme_johannes
Offline
Last seen:3周2天前
加入:2017-12-22 10:09
Hi MHv,

Hi MHv,

ad 1.:
GPIO映射是微不足道的,SPI总线在CLK / MOSI / MISO的标准端口上与闪存共享,CS(P1_3)和DRDY / int(P0_1)配置正确。初始化应使用多传感器DK工作,因为DK能够与BMI160(我们已验证)操作。

ad 2.:
A secondary bootloader has been burned to OTP by the manufacturer Inventek. I will discuss with them why they have not done it as you suggested. Maybe it is a misunderstanding.
我知道如何配置SmartSnippets, after all I have the firmware running and advertising (booting from flash).
In UM-B-101 it is stated that the MS DK secondary bootloader [...]

初始化IMU(ICM42605或BMI160)设备以SPI模式运行。

这就是为什么我询问这个​​特定引导加载程序的必要性。从调入代码,我是在印象中,引导加载程序为ICM42605配置了一些东西,但不适用于选项填充的BMI160。

For our previous prototype, that was based on the Murata ZY, we have ported the "old" IoT Sensor SDK, which as worked just fine. Certainly starting from scratch is a cleaner solution, but with limited manpower, stripping down an existing project is the faster approach...

BR Johannes.

MHv_Dialog
Offline
Last seen:2个月4周前
Staff
加入:2013-12-06 15:10
Hi Johannes,

Hi Johannes,

二级引导加载程序中的IMU初始化并不重要(坦率地说不知道为什么我们将其放置在那里),我没有看到代码中BMI160的任何引用。抱歉提出了明显的问题,但我假设您已经完全连接了BMI160,因为它在多传感器套件中连接(使用相同的中断等)。我还要假设您已正确初始化总线(在二级引导程序中,这是针对GPIOS的ICM IMU的ICM IMU的管理。

I will reach out to you directly later today to help troubleshoot this.

/ mhv.

gme_johannes
Offline
Last seen:3周2天前
加入:2017-12-22 10:09
Hi MHv,

Hi MHv,

I have some more findings.

(1) The initialization seems to be correct, whatever the bootloader may do, the MS DK also configures the GPIOs correctly. GPIOs and SPI parameters are configured in set_pad_functions and iot_dk_spi_init:

void periph_init(void) { // Power up peripherals' power domain SetBits16(PMU_CTRL_REG, PERIPH_SLEEP, 0); while (!(GetWord16(SYS_STAT_REG) & PER_IS_UP)); SetBits16(CLK_16M_REG, XTAL16_BIAS_SH_ENABLE, 1); //rom patch patch_func(); //Init pads set_pad_functions(); // (Re)Initialize peripherals iot_dk_spi_init(ACCEL_CS_PORT, ACCEL_CS_PIN, SPI_XTAL_DIV_2);

(2) I observe the exepcted activity on MISO, MOSI, CLK, CS with an oscilloscope. SPI seems to be working fine.

(3) I observe that the BMI160 interrupt goes high (shows again that the BMI160 seems to be programmed correctly through SPI), and this seems to be were the problem starts. The firmware does not react to the interrupt.

Following the observation (3) I have inspected the behavior with Ozone (spoiler: I used it for the first time). A breakpoint in

void si_setup_interrupts(si_list_entity_t * ptr)

在文件Sensors_Interface.c中显示了中断确实已配置。一个断点

void si_gpio_irq_cb(uint8_t port, uint32_t pin)

then shows that the callback is never executed, although the pin goes HIGH. The pin is correctly configured according to our schematic:

#define ACCEL_DRDY_PORT GPIO_PORT_0 #define ACCEL_DRDY_PIN GPIO_PIN_1 [...] GPIO_ConfigurePin(ACCEL_DRDY_PORT, ACCEL_DRDY_PIN,INPUT_PULLDOWN, PID_GPIO, false);

[编辑;删除了一部分,我现在认为是正常的,没有帮助找到问题]

In your earlier response you indicated that you wanted to contact me, but I did not receive a notification or email. Do you require my contact info?

BR Johannes.

编辑:

(a) The same is true is I enable the wake on motion feature. I can observe that the device goes to sleep, the interrupt is low. When I move the sensor, the pin indeed goes high, but the firmware does not react to it.
(b) I have disabled sleep mode for those tests.

gme_johannes
Offline
Last seen:3周2天前
加入:2017-12-22 10:09
亲爱的对话支持,

亲爱的对话支持,

我还在迫切等待答案。什么可能是中断不工作的原因?如何使用臭氧进一步调查此问题?

BR Johannes.

PM_DIALOG.
Offline
Last seen:1天7小时前
Staff
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

My apologies for the delay. I totally agree with MHv_Dialog and I think the best approach would be to use the empty_peripheral_template project and slowly move pieces of code into that project. However, I will the Team internally to get their feedback. I will get back to you as soon as possible.

谢谢,PM_DIALOG.

gme_johannes
Offline
Last seen:3周2天前
加入:2017-12-22 10:09
嗨pm_dialog,

嗨pm_dialog,

considering how much our project has in common with the MultiSensor DK (everything except for: missing env sensors, different magnetometer, different pinout, different flash/PA), I hope that you can understand that I still favor the approach of stripping down/modifying the MultiSensor DK. I hope that you have some ideas how to investigate why I don't see the interrupt.
Maybe I should start with testing the interrupt functionality itself with the empty_peripheral_template.

BR Johannes.

gme_johannes
Offline
Last seen:3周2天前
加入:2017-12-22 10:09
嗨pm_dialog,

嗨pm_dialog,

[any news? Any idea how I can solve this problem? Instructions for verification with Ozone would be great.]

编辑:
After lenghty investigations in the code, I noticed that in

void wkup_ad_cb(void)

仅检查寄存器P1和P2。然后我在UM-B-101中看到了这个问题:

目前,此模块支持端口1和2中的中断。此硬件配置不支持其他端口。

Can you please tell me - urgently - if interrupts on port 0 are not possible? What is the restriction here? SDK6? MultiSensor DK? DA14585?

编辑2:
I have modified the callback function and just added according conditions for port 0, it seems to work without a flaw.
It isVERYunfortunate how long it took for me to find this out. Sure, it is documented... but I would never have guessed that the implementation is incomplete. I would be very curious to understand the reason.

BR Johannes.

PM_DIALOG.
Offline
Last seen:1天7小时前
Staff
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

根据UM-B-101文档,585 MSK固件扩展了中断处理的可能性,以便唤醒。目前,此模块支持端口1和2中的中断,因为端口0保留用于其他范围。请记住,585 MSK旨在与MSK硬件一起使用。请看一下表1UM-B-101:DA14585 IOT多传感器开发套件开发人员指南文档以检查端口0分配。此外,如果检查WKUP_AD_CB()的源代码,则会看到端口1和2配置了。

// IO端口寄存器volatile uint32_t * ptr_p1 =(volatile uint32_t *)p1_data_reg;volatile uint32_t * ptr_p2 =(volatile uint32_t *)p2_data_reg;

谢谢,PM_DIALOG.

gme_johannes
Offline
Last seen:3周2天前
加入:2017-12-22 10:09
嗨pm_dialog,

嗨pm_dialog,

as I've written in the second edit, I have solved the problem. It was unproblematic to get the interrupt on port 0, after all.

Thanks,

Johannes