你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

VL53L5CX如何实现超过15HZ的采样?超频会引发什么现象?

[复制链接]
xu@xupt 提问时间:2023-11-2 10:55 / 已解决
收藏 评论3 发布时间:2023-11-2 10:55

举报

3个回答
深圳好星星 最优答案 回答时间:2023-11-6 14:08:54

8x8模式最大可以跑到50Hz,但是要改一下寄存器。

int example17(void) {

// / VL53L5CX ranging variables / //

uint8_t status, isAlive, isReady, i, j; uint16_t loop; VL53L5CX_Configuration Dev; / Sensor configuration / uint16_t distance[VL53L5CX_RESOLUTION_8X8]; / Array of 64 zones which returns the data / uint32_t timestamp = 0;

// / Customer platform / //

/* Fill the platform structure with customer's implementation. For this

  • example, only the I2C address is used. */ Dev.platform.address = VL53L5CX_DEFAULT_I2C_ADDRESS;

/ (Optional) Reset sensor toggling PINs (see platform, not in API) / //Reset_Sensor(&(Dev.platform));

/* (Optional) Set a new I2C address if the wanted address is different

  • from the default one (filled with 0x20 for this example). */ //status = vl53l5cx_set_i2c_address(&Dev, 0x20);

// / Power on sensor and init / //

/ (Optional) Check if there is a VL53L5CX sensor connected / status = vl53l5cx_is_alive(&Dev, &isAlive); if(!isAlive || status) { printf("VL53L5CX not detected at requested address\n"); return status; }

/ (Mandatory) Init VL53L5CX sensor / status = vl53l5cx_init(&Dev); if(status) { printf("VL53L5CX ULD Loading failed\n"); return status; }

printf("VL53L5CX ULD ready ! (Version : %s)\n", VL53L5CX_API_REVISION);

// / Set some params / //

/ Program continuous mode (best one for speed) / status = vl53l5cx_set_ranging_mode(&Dev, VL53L5CX_RANGING_MODE_CONTINUOUS);

/ Change resolution. Use 8x8 for this example, but 4x4 is also supported / //status = vl53l5cx_set_resolution(&Dev, VL53L5CX_RESOLUTION_8x8);

status = vl53l5cx_set_resolution(&Dev, VL53L5CX_RESOLUTION_8X8);

/ Reduce sharpener. This is mandatory as the signal strength is very low / status = vl53l5cx_set_sharpener_percent(&Dev, 0);

/ Increase max frequency. Dedicated function to be created in the future / uint8_t frequency_hz = 50; // Max 4x4: 150 fps / max 8x8: 50 fps status = vl53l5cx_dci_replace_data(&Dev, Dev.temp_buffer, VL53L5CX_DCI_FREQ_HZ, 4,(uint8_t*)&frequency_hz, 1, 0x01);

// / Ranging loop / //

/ Use dedicated start ranging function in “plugin_fast_ranging” / status = vl53l5cx_start_fast_ranging(&Dev);

loop = 0; while(loop < 1000) { /* Use polling function to know when a new measurement is ready.

  • Another way can be to wait for HW interrupt raised on PIN A3
  • (GPIO 1) when a new measurement is ready */
status = vl53l5cx_check_data_ready(&Dev, &isReady);

if(isReady)
{
    /* Get all the distances and decompress them */
    status = vl53l5cx_get_fast_ranging_data(&Dev, distance);

    /* Print 8x8 zones */
    for(i = 0; i < 8; i++){
        for(j = 0; j < 8; j++){

            /* Check if distance is valid. Max distance has been limited to 2047 mm in the
             * firmware. When a target status is flagged as invalid, the distance is set to 2048. It
             * allows to easily detect invalid data.
             */

            if(distance[i * 8 + j] == VL53L5CX_FAST_RANGING_INVALID_STATUS)
            {
                printf("xxxx, ");
            }
            else
            {
                printf("%4u, ", distance[i * 8 + j]);
            }
        }
        printf("\n");
    }
    printf("\n");

    /* For STM32 only: print the time elapsed since last frame */
    printf("Time %d ms\n",(int)(HAL_GetTick() - timestamp));
    timestamp = HAL_GetTick();

    // loop++;
}

/* Wait a few ms to avoid too high polling (function in platform
 * file, not in API) */
//WaitMs(&(Dev.platform), 5);

}

/ Stop the sensor: use dedicated stop ranging function in “plugin_fast_ranging” / status = vl53l5cx_stop_fast_ranging(&Dev); printf("End of ULD demo\n"); return status; }

xu@xupt 回答时间:2023-11-3 16:06:54

自己顶一下

xu@xupt 回答时间:2023-11-6 19:19:57
深圳好星星 发表于 2023-11-6 14:08
[md]8x8模式最大可以跑到50Hz,但是要改一下寄存器。

[md]感谢

所属标签

相似问题

官网相关资源

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32Cube扩展软件包
意法半导体边缘AI套件
ST - 理想汽车豪华SUV案例
ST意法半导体智能家居案例
STM32 ARM Cortex 32位微控制器
关注我们
st-img 微信公众号
st-img 手机版