06-15-2020 08:37 PM
Hello everyone!!!
I use Nuvoton M451 MCU with BMX160,
The communication protocol uses SPI,
I will read the BMX160 CHIP ID but cannot succeed
rslt =-3(DEVICE NOT FOUND)
Re-read CODE several times
It is found that the Read and write functions in the struct may not be well written
CHIPID cannot be read normally
-----------------------------------------------------------------------------------
struct bmi160_dev bmi;
bmi.id = 0;
bmi.interface = BMI160_SPI_INTF;
bmi.read = (bmi160_com_fptr_t)user_spi_read;
bmi.write = (bmi160_com_fptr_t)user_spi_write;
bmi.delay_ms = (bmi160_delay_fptr_t) Delayus;
-----------------------------------------------------------------------------------
I would like to ask!!!
bmi.read = (bmi160_com_fptr_t)user_spi_read;
bmi.write = (bmi160_com_fptr_t)user_spi_write;
The workflow of these two functions and how to write
06-16-2020 12:34 AM
You need to link / map the SPI read / write function in your MCU complier to those funciton.
In the API, they are just dumy function which need to be map by user.
06-16-2020 06:36 AM
HI Vincent
Understand~~
So we also need to write the function of MCU by ourselves to use for FUNCTION
So how do I give these functions to FUNCTION?
Is there any reference to this FUNCTION design flow and examples!!
Thank you
06-17-2020 02:59 AM
You can just rewrite / replace your SPI read and write function in the API.
It is the generic SPI function on your MCU platform.