Giter VIP home page Giter VIP logo

afbr-s50-api's People

Contributors

c-berger avatar copy05 avatar goetzfrv avatar ravijaladi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

afbr-s50-api's Issues

Range Offset Calibration function

Hi,

As I asked in my previous issue, I want to know how can I integrate the Range Offset Calibration function into my code?

image

Thank you for your support

AFBR-S50MV85I and Arduino

Hello,

I'm new with this kind of TOF sensor.
Can it be controlled by an Arduino ?
Is it complicated to port the code ?

Thank you.

Timer interval in 02_advanced_example.c

Hello,

By default, the timer interval for the interrupt is set to 100ms, isn't it ?

image

If I want to change it, I just have to modify the value here ?

Thank you.

Regards,

Can't run step-by-step crosstalk calibration

Hi,

I am using an AFBR-S50MV85G ToF sensor behind a cover glass and I would like to run a calibration in order to mitigate optical crosstalk from this cover glass. I am using CubeIDE for developping the software.
I've integrated both argus_xtalk_cal_cli.h and argus_xtalk_cal_cli.c into my project and I'm invoking Argus_XtalkCalibration_CLI() within the main() . However, I can't compile the project because the function UART_SetRxCallback() is not defined.
I've been following Broadcom Programming Guide (version 1.2) to set up the UART Interface (P62) but there is no information provided regarding UART RX handling. I assume I need to establish the UART RX interface in a manner similar to the TX interface, but I'm unsure of the approach.

For now, I'm retrieving user inputs by calling HAL_UART_Receive_DMA(&huart2, &rxdata, 1) in Get_UARTRxdata() . It seem to work, but I assume this is not the optimal solution and it might be the reason of my problem. Indeed, when I run the step-by-step crosstalk procedure (by typing 's' in a terminal), I'm receiving weirds characters (just like a wrong baudrate ) :

Weird UART

So here is my question, how can I accomplish the step-by-step calibration successfully ?

Regards

Unable to Build Example App with Xtalk Calibration Enabled

Hi,
I am trying to calibrate the AFBR-S50 Reference Board by MikroElektronika, but am having problems while attempting to build the Example App.

I cloned the main branch of the repository AFBR-S50-API in January this year and am using e2studio (Version: 2023-10 (23.10.0)) with FSP 4.4.0 for development.

The problem is as follows:

  • When I set the RUN_XTALK_CALIBRATION flag to 1 in order to enable crosstalk calibration, the build fails with the following error:
    fatal error: argus_xtalk_cal_cli.h: No such file or directory
    image
  • It's worth noting that the build works successfully when RUN_XTALK_CALIBRATION is set to 0.
  • The Xtalk-CLI directory is not listed in includes.
    Screenshot 2024-04-18 095331
  • Adding the directory to includes via Properties -> C/C++ Build -> Settings -> GNU ARM Cross C Compiler -> Includes results in the same error.
  • Similarly, adding the directory via Properties -> C/C++ Build -> Settings -> GNU ARM Cross C Linker -> Libraries also results in build errors.

I would appreciate your advice on how to resolve this issue so that I can calibrate the sensor. Thank you in advance!

Multiple Sensor

Is there a way to use two or more LIDAR sensors without having to rewrite a lot of argus file ?

How to run it on Raspberry Pi Pico?

Hi,

I'm trying to compile it for Raspberry Pi Pico (RP2040, ARM Cortex-M0+) but I can't get it to work. I'm not sure what I'm doing wrong, maybe my CMakeLists.txt is not properly set up.

My current project structure is as follows:
Project/
├──libraries/
│..├──AFBR-S50-API/
│..│..├──Include/
│..│..│..├──api/
│..│..│..│..├──
│..│..│..│..└── CMakeLists.txt
│..│..│..├──platform/
│..│..│..│..├──
│..│..│..│..└── CMakeLists.txt
│..│..│..├──utility/
│..│..│..│..├──
│..│..│..│..└── CMakeLists.txt
│..│..│..├── argus.h
│..│..│..└── CMakeLists.txt
│..│..├──Lib/
│..│..│..└── < .a files>
│..│..├──Test/
│..│..│..└── < Test files >
│..└── CMakeLists.txt
├── main.c
├── pico_sdk_import.cmake
└── CMakeLists.txt

So, I've put your library into the "libraries" folder and added CMakeLists.txt to each folder.
"CMakeLists.txt" in the "api", "platform", and "utility" is simply

project(api)

target_sources(${PROJECT_NAME} PUBLIC)

target_include_directories(${PROJECT_NAME} INTERFACE
${CMAKE_CURRENT_LIST_DIR} )

Where the project name (in this case "api") is set to the folder name

"CMakeLists.txt" in the "Include" folder is:

project(AFBR)

add_library(${PROJECT_NAME} INTERFACE)

target_include_directories(${PROJECT_NAME} INTERFACE
    ${CMAKE_CURRENT_LIST_DIR}
    ${CMAKE_CURRENT_LIST_DIR}/api
    ${CMAKE_CURRENT_LIST_DIR}/platform
    ${CMAKE_CURRENT_LIST_DIR}/utility
)

target_link_libraries(${PROJECT_NAME} INTERFACE
    ${CMAKE_CURRENT_LIST_DIR}/../Lib/libafbrs50_m0p.a
)

"CMakeLists.txt" in the "libraries" folder is just

add_subdirectory(AFBR-S50-API/Include)

The main "CMakeLists.txt" is:

cmake_minimum_required(VERSION 3.12)

# Pull in SDK (must be before project)
include(pico_sdk_import.cmake)

# set the project name
project(picotest C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

if (PICO_SDK_VERSION_STRING VERSION_LESS "1.3.0")
    message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif()

# Initialize the SDK
pico_sdk_init()

if (TARGET tinyusb_device)
    add_executable(${PROJECT_NAME}
        main.c
        libraries/AFBR-S50-API/Test/argus_hal_test.c
    )
            
    add_subdirectory(libraries)

    # pull in common dependencies
    target_link_libraries(${PROJECT_NAME} 
	pico_stdlib 
	hardware_spi
	hardware_uart
	hardware_irq
	hardware_gpio
	hardware_flash
	hardware_sync
	hardware_pwm
	hardware_adc
	pico_time
	pico_multicore
	pico_platform
	AFBR
	)
	
	# target_include_directories(${PROJECT_NAME} PUBLIC libraries)
	
	pico_set_binary_type(${PROJECT_NAME} copy_to_ram)

    # enable usb output, disable uart output
    pico_enable_stdio_usb(${PROJECT_NAME} 1)
    pico_enable_stdio_uart(${PROJECT_NAME} 0)

    # create bin and uf2 files
    pico_add_bin_output(${PROJECT_NAME})
    pico_add_uf2_output(${PROJECT_NAME})

elseif(PICO_ON_DEVICE)
    message(WARNING "not building the project because TinyUSB submodule is not initialized in the SDK")
endif()

add_compile_options(-Wall
        -Wno-format          # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
        -Wno-unused-function # we have some for the docs that aren't called
        -Wno-maybe-uninitialized
        )

My "main.c"

#include "pico/stdio.h"
#include "stdio.h"
#include "stdlib.h"
#include "pico/stdlib.h"
#include "hardware/clocks.h"
#include "pico/sync.h"
#include "hardware/xosc.h"
#include "pico/multicore.h"
#include "string.h"
#include "pico/platform.h"
#include "hardware/pwm.h"
#include "hardware/gpio.h"

#include "hardware/spi.h"

#include "libraries/AFBR-S50-API/Test/argus_hal_test.h"


int main()
{
  stdio_init_all();
  // a small delay just to be able to read the output of the test
  for(int i = 0; i < 10; i++)
  {
    sleep_ms(1000);
    printf("%d\n", i);
  }
  // init spi
  spi_init(spi1, 10000000);
  spi_set_format(spi1, 8, SPI_CPOL_1, SPI_CPHA_1, SPI_MSB_FIRST);
  gpio_set_function(12, GPIO_FUNC_SPI);
  gpio_set_function(14, GPIO_FUNC_SPI);
  gpio_set_function(15, GPIO_FUNC_SPI);
  gpio_set_function(13, GPIO_FUNC_SIO);
  gpio_set_dir(13, true);
  gpio_put(13, true);

  Argus_VerifyHALImplementation(13);

  while(true)
  {
    sleep_ms(1000);
  }
  return 0;
}

I'm also attaching the project folder if you want to look it at it yourself
AFBR-S50.tar.gz

Improve reactivity

Hi,

I am designing a product that embed a Broadcom AFBR-S50MV85G in order to detect objects and people in the range 0 - 5 meters, in indoor and outdoor.
I have designed the software base on your API (version 1.4.4), it work great but I would like to improve detection speed. Indeed ,when something is passing very quickly in the ToF FOV, the range measurement are not updated accordingly, only the status code returned is changing (- 110 instead of 0).

Measurements on quick objects

I assume this latency is due to the Dynamic Configuration Algorithm which is updating is parameters due to this suddent distance change. So here is my questions : How can we reduce this latency ? Can we disable the DCA ? Can we change the parameters used by the DCA to improve reactivity ? Thank for your answers.

For information, I am using the sensor at 100 Hz with Short Range mode, DFM Mode 4X, and SNM in dynamic mode.

AFBR-S50 v1.4.4 Crash

Hello,

Upon launching the application, an error window similar to the one depicted in the attached image pops up. Additionally, the following log appears in the bottom section of the program:

Status/Log: Fatal: An unhandled exception occured! Vstupní řetězec nemá správný formát. v System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)

After dismissing the dialogue, the program terminates abruptly. It's worth noting that version 1.3.5 of the program functions properly; however, it seems to lack compatibility with the board.

Could you please provide assistance in resolving this issue? Any guidance or recommendations would be greatly appreciated.

afbr50
afbr50 crash

Thank you.
Jan

Low laser power or bad precision after porting to STM32 M4 (L4 variant)

Hello,

Im using an AFBR-S50MV85G with a Nucleo board STM32L432KC. I "succesfuly" ported the code to the board and passed the HAL tests.
Playing with the examples, high speed or not, i have very bad measurements when object is farther than 800mm, objects farther than 1 meter shows they are at about 2 or 3, and with objects at 2 meters it could report they are about 10, 20, or 30 meters. Also the sensor becomes too hot, especially in high speed mode and eventually could stop working reporting this error:
ERROR: DCA: Laser Failure or High Ambient Light Detected! Continuous low reference amplitude due to laser failure or high ambient light detected!

When objects are closer than 800mm it works ok, so it seems like a not enough power problem?

Also, i cannot try the example at 1000hz or faster because it reports a lot of errors:
ERROR: Integration Timeout! Elapsed 887 usec; Timeout 465 usec!

This board only has one 32bit timer i can use for the LTC, so i'm suspecting maybe my LTC timer implementation is bad. Could a bad LTC timer implementation cause this errors? What other software issues could be causing this behavior?

I check with two different AFBR-S50MV85G and different components including the board and with both i have the same results.
Thanks

Reading the sensor board with a microcontroller

I'm able to display measurements using a serial to USB adapter, but I am unable to receive data in any UART configuration on the STM32 (DMA/Interrupt/Poll).
I've checked the signal using an oscilloscope and it all looks fine. I'm using the high speed 1000 Hz example code.

Has anyone been successful reading the sensor from a microcontroller?
Any assistance would be appreciated. Apologies if this is the wrong place to post this.

Sebastian Thwaites
University of Newcastle

Is a jumper or setting needed to enable UART comms on the MIKROE reference board?

So I am using the MIKROE-5631 reference board, and I followed these instructions for activating the bootloader and flashing a program. I flashed AFBR-S50-RA4M2-v1.5.6.zip from here. That all works great when connected to the AFBR.S50.SDK.v1.5.6-basic.msi explorer app via a USB cable. The whole thing talks and works very well. However, when connected via UART, either directly to my application circuit, or to the computer via this FTDI USB to serial adapter, I never get any responses at all from the reference board. Not even a NAK (0x0B) response. The explorer app shows an immediate "I can't connect" error message as soon as you try to connect.

I've verified (via oscilloscope) that the transmit pulses are clean and correct, and I've tried both 3.3V and 5V. I've used the pinout provided right here, which seems to be correct based on pin 3 (TXD) being pulled high by the reference board. I've used my own application software, the provided python code, and the AFBR Explorer app. In none of these cases does any UART packet ever get transmitted back from the reference board.

I'm posting here because I'm kind of out of things to try. There must be something I'm missing about how to switch out of USB and into UART mode or something. Please help!

RISC-V libary compilation

Hi,

Is there a possibility to see the libary being recompiled for risc-v targets like IMC or IMAC. This would open up the usage with the popular ESP32 platform and other low cost modules.

Thanks

1.4.4 stack on startup is sometimes larger

I recently updated to 1.4.4. I noticed that I started getting a random hardfault on boot and traced it to the AFBR driver sometimes using more stack causing it to overrun the amount allocated to the task.

Currently I have 1872 bytes allocated to the task. After increasing that, I found that the AFBR sometimes uses 2068 on startup instead of 1876.

Upon power cycling, it appears to be random how much stack it uses. Can you tell me why this is the case?

Disabling the Pixels

We want to use the sensor with high frame rates (3kHz). According to what is written in the datasheet, we need to reduce the number of pixels to 8. We are trying to do this right now. But we got a few issues.
How can we manage the pixels safely, how safe is it to disable random pixels? .
We found a "argus_map.h" header file in API. We thought, we can use macros in it. But, what is our 32-bit pixel mask that is used as arguments in macro functions here? How can we determine this?
And last one, can we find an example C/C++ code about disabling pixels safely?

AFBR-S50 Explorer

Hello,

I've download and install AFBR-S50 Explorer to use it wit the dev kit from broadcom but the software start and get and imediate error.

Even before connecting the board to the computer. Can you help me with that ?

Thanks
Sébastien

image

Incorrect range when entering/exiting beam

When an object enters or exits the laser, I am seeing 0-3 invalid ranges. For example (annotated afterward):

[many 3638 mm entries]
68 Hz, 0 status, 100 quality,   83 LSB amplitude, 3332 mm  <- incorrect
61 Hz, 0 status, 100 quality,  698 LSB amplitude, 1819 mm  <- incorrect
57 Hz, 0 status, 100 quality, 1092 LSB amplitude,  560 mm
61 Hz, 0 status, 100 quality, 1200 LSB amplitude,  582 mm
55 Hz, 0 status, 100 quality, 1129 LSB amplitude,  591 mm
56 Hz, 0 status, 100 quality,  921 LSB amplitude,  595 mm
51 Hz, 0 status, 100 quality,  699 LSB amplitude,  553 mm
64 Hz, 0 status, 100 quality, 1149 LSB amplitude,  590 mm
68 Hz, 0 status, 100 quality,  601 LSB amplitude,  593 mm
53 Hz, 0 status, 100 quality,  600 LSB amplitude,  594 mm
68 Hz, 0 status, 100 quality,  569 LSB amplitude,  588 mm
53 Hz, 0 status, 100 quality,  483 LSB amplitude,  591 mm
68 Hz, 0 status, 100 quality,  409 LSB amplitude,  590 mm
53 Hz, 0 status, 100 quality,  327 LSB amplitude,  601 mm
69 Hz, 0 status, 100 quality,  353 LSB amplitude,  579 mm
53 Hz, 0 status, 100 quality,  391 LSB amplitude,  593 mm
68 Hz, 0 status, 100 quality,  316 LSB amplitude,  978 mm  <- incorrect
52 Hz, 0 status, 100 quality,  169 LSB amplitude, 1921 mm  <- incorrect
72 Hz, 0 status, 100 quality,   98 LSB amplitude, 3375 mm  <- incorrect
[many 3638 mm entries]

This may be related to #10, but I didn't want to clutter up that issue if it is not.

As mentioned in #10, I tried disabling DFM. I also (separately and together) tried adjusting DCA as shown there. I did not see that this changed the problematic behavior.

status = Argus_SetConfigurationDFMMode(device, DFM_MODE_OFF);
checkFail(status, "Argus_SetConfigurationDFMMode failed!", true);

argus_cfg_dca_t dca;
status = Argus_GetConfigurationDynamicAdaption(device, &dca);
checkFail(status, "Get DCA configuration failed!", true);
dca.SatPxThExp = 1; // [1;33]
dca.SatPxThLin = 1; // [1;33]
dca.SatPxThRst = 1; // [1;33]
status = Argus_SetConfigurationDynamicAdaption(device, &dca);
checkFail(status, "Set DCA configuration failed!", true);

Is there a way to avoid these incorrect range readings?

If not, what approach should be used to discard them? Discarding the first ~4 readings is possible, but adds latency. That helps entering the beam, but not exiting. For exiting I could discard based on too large of a distance from previous readings, but it doesn't seem great.

I'd like to run at 30Hz rather than the 60Hz shown above. The behavior is roughly the same at 30Hz.

BTW, it'd be helpful if the doxygen API documentation listed default values.

Unable to Build Example App

Hi, this is a follow up to issue #23 posted last Thursday. FSP and e2studio version are still the same.

I have downloaded the updated repository and the project now fails to build even when RUN_XTALK_CALIBRATION is set to 0.

The errors from three attempts to run when RUN_XTALK_CALIBRATION is set to 0 can be found below:
image
image
image

The errors from three attempts to run when RUN_XTALK_CALIBRATION is set to 1 can be found below:
image
image
image

The project was cleaned and refreshed between each attempt.
Building the Can App also fails with similar errors when it succeeded before the update.

E2 Lite Debugger

Has anyone been successful with connecting to the Mikroe reference board using a E2 Lite Debugger?
(https://www.mikroe.com/bdc-afbr-s50-tof-sensor-board)

Running Projects/e2Studio/AFBR_S50_Example_RA4M2 gives this error: Not connected to the user system.

Starting server with the following options: 
        Raw options                : C:\Users\thwai\.eclipse\com.renesas.platform_1435879475\DebugComp\\RA\e2-server-gdb -g E2LITE -t R7FA4M2AD -uConnectionTimeout= 30 -uClockSrc= 0 -uAllowClockSourceInternal= 1 -uInteface= SWD -uIfSpeed= auto -w 0 -z 33 -uResetCon= 1 -uLowPower= 1 -uEnableSciBoot= 0 -uresetOnReload= 1 -n 0 -uFlashBp= 1 -uhookWorkRamSize= 0x400 -ueraseRomOnDownload= 1 -ueraseDataRomOnDownload= 1 -uTraceMTB= 0 -uTraceSizeMTB= 1024 -uProgReWriteIRom= 0 -uProgReWriteDFlash= 0 -uOSRestriction= 0 -uTimeMeasurementEnable= 1 -uDWTEnable= 0 -uMemRegion= 0x20000000:0x4C00:RAM:s -uMemRegion= 0x20004C00:0x1400:RAM:c -uMemRegion= 0x00000000:0x20800:FLASH:s -uMemRegion= 0x00020800:0x7800:FLASH:c -uMemRegion= 0x08000000:0x0:DATA_FLASH:s -uMemRegion= 0x0100A100:0x80:OPTION_SETTING:s -uMemRegion= 0x0100A200:0xCC:OPTION_SETTING_S:s -uMemRegion= 0x00000000:0x0:ID_CODE:s -uMemRegion= 0x80010000:0x0:SDRAM:s -uMemRegion= 0x60000000:0x0:QSPI_FLASH:s -uMemRegion= 0x80020000:0x0:OSPI_DEVICE_0:s -uMemRegion= 0x80030000:0x0:OSPI_DEVICE_1:s -uMemRegion= 0x00028000:0x58000:FLASH:n -uMemRegion= 0x08000000:0x2000:DATA_FLASH:n -uTz= SSD -l -uCore= SINGLE_CORE|enabled|1|main -uSyncMode= async -uFirstGDB= main --english --gdbVersion= 12.1

Connecting to E2LITE, ARM target
        GDBServer endian           : little
        Target power from emulator : Off 
Starting target connection
GDB action 'connect to target', has failed with error report, Error 0x00040102: Not connected to the user system.

force_kill_gdb()
Disconnected from the Target Debugger.

Any assistance would be greatly appreciated.
Sebastian
University of Newcastle

Underwater Calibration

Hi,

I am currently using 3 AFBR-S50MV68B with an STM32L451RE. Those sensors perform underwater measurements.
As the light moves slower in water, I just had to add a 0.75 coefficient to the obtained the correct "Range" values.
So far it is working fine.

A few weeks ago, you released a new version including the sensor calibration. As I use cover glasses in my application I would like to perform such a calibration. However, it is impossible to perform the step 2 (Electrical + Optical Xtalk Measurement (without Cover)) as the cover glass ensures waterproofing...

I thought about two options:

  1. Doing a 'classic air' calibration and hope for a correct behaviour underwater.
  2. Doing a first 'classic air' calibration:
    Consider the impact of the cover glass erased.
    Doing a second calibration, with water measurements instead of cover glass effect. Something like:

1 Step1
2 Long distance measurement on optical sink, in air with cover glass
3 Long distance measurement on optical sink, in water with cover glass

Which one do you think it is the best?
Do you have any suggestions?

Thanks,
Lucas

I want to see the file before compilation

Hi! I want to browse the c language files in the implementation. If you don't mind the license, could you please upload the original files to create the compiled .a files under AFBR-S50-API/AFBR-S50/Lib/?

I would like to check the detailed implementation of the measurement algorithm and change the contents of the printed error message.

Add Measurement Mode

I would like a measurement mode that takes as long as it needs to produce a valid measurement. Currently you need to set a measurement time in Argus_SetConfigurationFrameTime.

Import issue

Hi,

I am trying to import this project to E2 Studio. but there were 19 errors when I built it as shown in the figure. So what can I do about it?

kind regards
Davidd
787ad0f661d2f9f5ca1b141490494bc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.