完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
亲爱的社区
我在连续模式下使用带有800Hz ODR的LIS2DW12加速度计。我将fifo水印阈值设置为25个样本,并在INT1引脚上启用水印中断。我在STM32微控制器上的中断例程中读取了fifo中的数据。 应用程序正常工作,数据可以正确读取。到现在为止还挺好... 有时在“正常”中断再次设置为低电平后,传感器会产生第二个(意外)中断事件。 这里是示波器在加速度计的INT1-Pin上的屏幕截图: 第二个脉冲使微控制器再次进入中断程序,尽管在这么短的时间之后不应该有新的数据可用。 非常感谢您的回答! 最好的祝福, 塞拉斯 以上来自于谷歌翻译 以下为原文 Dear community I'm using the LIS2DW12 accelerometer with 800Hz ODR in continuous mode. I've set the fifo watermark threshold to 25 samples and enabled the watermark interrupt on INT1-pin. I read the data from the fifo inside an interrupt-routine on a STM32 microcontroller. The application works and the data can be read correctly. So far so good... Sometimes there is a second (unexpected) interrupt event generated by the sensor, right after the "normal" interrupt was set low again. Here a screenshot from the oscilloscope on the INT1-Pin of the accelerometer: This second pulse causes the microcontroller to enter the interrupt-routine again, although there shouldn't be new data available after this short time. Many thanks for your answers! Best regards, Silas |
|
相关推荐
3个回答
|
|
你能分享你的传感器配置吗?
我想当你读取一个样本然后传感器将一个样本放入FIFO并再次达到FIFO水印时就会发生这种情况。 以上来自于谷歌翻译 以下为原文 Can you please share your sensor configuration? I guess it can happen when you read a one sample and then the sensor will put one sample to the FIFO and reach again FIFO watermark. |
|
|
|
你好Miroslav
这是传感器的配置代码: //配置电源模式 lis2dw12_power_mode_set(LIS2DW12Handler,LIS2DW12_HIGH_PERFORMANCE); //启用块数据更新 lis2dw12_block_data_update_set(LIS2DW12Handler,PROPERTY_ENABLE); //设置满刻度 lis2dw12_full_scale_set(LIS2DW12Handler,LIS2DW12_16g); //设置输出数据速率 lis2dw12_data_rate_set(LIS2DW12Handler,LIS2DW12_XL_ODR_800Hz); // 设置模式 lis2dw12_fifo_mode_set(LIS2DW12Handler,LIS2DW12_STREAM_MODE); //设置fifo阈值 lis2dw12_fifo_watermark_set(LIS2DW12Handler,(25-1)); //自动递增传感器中的内存地址(用于连续数据读取) lis2dw12_auto_increment_set(LIS2DW12Handler,PROPERTY_ENABLE); //设置中断设置 lis2dw12_int_notification_set(LIS2DW12Handler,LIS2DW12_INT_PULSED); lis2dw12_pin_mode_set(LIS2DW12Handler,LIS2DW12_PUSH_PULL); lis2dw12_pin_polarity_set(LIS2DW12Handler,LIS2DW12_ACTIVE_HIGH); lis2dw12_ctrl4_int1_pad_ctrl_t RegisterValue; RegisterValue.int1_fth = PROPERTY_ENABLE; lis2dw12_pin_int1_route_set(LIS2DW12Handler,& RegisterValue); 并且中断例程中的读出代码如下所示(总共有25个样本一起读取): //读取传感器数据 HAL_GPIO_WritePin(LIS2DW12_SPI_CS_GPIO_Port,LIS2DW12_SPI_CS_Pin,GPIO_PIN_RESET); uint8_t寄存器= LIS2DW12_OUT_X_L; 注册| = 0x80; if(HAL_SPI_TransmitReceive_DMA(SensorHandler-> SPIHandler,& Register, (uint8_t *)TempSensorDataBuffer,25 * 6)!= HAL_OK) { sensor_error(SensorHandler); } 以上来自于谷歌翻译 以下为原文 Hello Miroslav This is the configuration code of the sensor: // Configure power mode lis2dw12_power_mode_set(LIS2DW12Handler, LIS2DW12_HIGH_PERFORMANCE); // Enable Block Data Update lis2dw12_block_data_update_set(LIS2DW12Handler, PROPERTY_ENABLE); // Set full scale lis2dw12_full_scale_set(LIS2DW12Handler, LIS2DW12_16g); // Set output data rate lis2dw12_data_rate_set(LIS2DW12Handler, LIS2DW12_XL_ODR_800Hz); // Set mode lis2dw12_fifo_mode_set(LIS2DW12Handler, LIS2DW12_STREAM_MODE); // Set fifo threshold lis2dw12_fifo_watermark_set(LIS2DW12Handler, (25- 1)); // Auto-Increment memory address in sensor (for continuous data reading) lis2dw12_auto_increment_set(LIS2DW12Handler, PROPERTY_ENABLE); // Set interrupt settings lis2dw12_int_notification_set(LIS2DW12Handler, LIS2DW12_INT_PULSED); lis2dw12_pin_mode_set(LIS2DW12Handler, LIS2DW12_PUSH_PULL); lis2dw12_pin_polarity_set(LIS2DW12Handler, LIS2DW12_ACTIVE_HIGH); lis2dw12_ctrl4_int1_pad_ctrl_t RegisterValue; RegisterValue.int1_fth = PROPERTY_ENABLE; lis2dw12_pin_int1_route_set(LIS2DW12Handler, &RegisterValue); And the readout code in the interrupt routine looks like this (there are always 25 samples read together): // Read sensor data HAL_GPIO_WritePin(LIS2DW12_SPI_CS_GPIO_Port, LIS2DW12_SPI_CS_Pin, GPIO_PIN_RESET); uint8_t Register = LIS2DW12_OUT_X_L; Register |= 0x80; if(HAL_SPI_TransmitReceive_DMA(SensorHandler->SPIHandler, &Register, (uint8_t *)TempSensorDataBuffer, 25 * 6) != HAL_OK) { sensor_error(SensorHandler); } |
|
|
|
配置对我来说似乎没问题。
您能否捕获SPI通信,或至少SPI时钟,因此我们可以看到中断和SPI读取事务之间的相关性。如果第二个中断将在数据读取的开始,那么我的想法是正确的(所以简单的解决方案可以忽略所有中断,直到你从FIFO读取所有25个样本)。 以上来自于谷歌翻译 以下为原文 The configuration seems OK to me. Can you please capture also the SPI communication, or at least the SPI clock, so we can see the correlation between interrupt and SPI read transaction. If the second interrupt will be at the beginning of the data read, than my idea is correct (so the simple solution could be ignore all interrupts until you read all 25 samples from FIFO). |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2574 浏览 1 评论
3192 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1761 浏览 1 评论
3587 浏览 6 评论
5965 浏览 21 评论
924浏览 4评论
1300浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
563浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1286浏览 3评论
1338浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-5 12:23 , Processed in 0.995941 second(s), Total 51, Slave 44 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号