Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIClass error in VL53L8CX_HelloWorld_SPI.ino #10

Open
2hgeng opened this issue Aug 29, 2024 · 13 comments
Open

SPIClass error in VL53L8CX_HelloWorld_SPI.ino #10

2hgeng opened this issue Aug 29, 2024 · 13 comments
Assignees

Comments

@2hgeng
Copy link

2hgeng commented Aug 29, 2024

Compilation error:
error: no matching function for call to 'arduino::HardwareSPI::HardwareSPI(unsigned int, unsigned int, unsigned int)'
SPIClass DEV_SPI(SPI_MOSI_PIN, SPI_MISO_PIN, SPI_CLK_PIN);

@2hgeng 2hgeng added the bug Something isn't working label Aug 29, 2024
@fpistm fpistm removed the bug Something isn't working label Aug 29, 2024
@cparata
Copy link
Contributor

cparata commented Aug 30, 2024

Hi @2hgeng ,
it seems that for Arduino mbedOS derived board there is not the constructor for the SPIClass as you can see here. In your specific case, you can try to use directly the SPI instance and see if it works.
So, try to replace:

SPIClass DEV_SPI(SPI_MOSI_PIN, SPI_MISO_PIN, SPI_CLK_PIN);

with

#define DEV_SPI SPI

Pay attention to connect the VL53L8CX SPI pins to the pins of the SPI instance on the Portenta board.

Best Regards,
Carlo

@2hgeng
Copy link
Author

2hgeng commented Aug 30, 2024

I am connecting to SPI1 of Portenta board, the start ranging function status is 255 (decimal) and no data is received from sensor.

`#define CS_PIN PI_0
#define DEV_SPI SPI

VL53L8CX sensor_vl53l8cx_top(&DEV_SPI, CS_PIN);

void setup()
{
// Initialize SPI bus.
DEV_SPI.begin();

// Set SPI settings
DEV_SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1));

// Configure VL53L8CX component.
sensor_vl53l8cx_top.begin();
status = sensor_vl53l8cx_top.init();

// Start Measurements
status = sensor_vl53l8cx_top.start_ranging();
}`

@cparata
Copy link
Contributor

cparata commented Aug 30, 2024

Hi @2hgeng ,
could you share your hardware setup? Which board with VL53L8CX are you using?
Best Regards,
Carlo

@cparata
Copy link
Contributor

cparata commented Aug 30, 2024

And how the VL53L8CX sensor is connected to the Portenta board?

@2hgeng
Copy link
Author

2hgeng commented Aug 30, 2024

I am using VL53L8CX breakout board
https://www.pololu.com/product/3419

and connecting it to Portenta breakout board SPI1.

IMG_2634

@cparata
Copy link
Contributor

cparata commented Aug 30, 2024

Did you connect the SPI_I2C_N pin of the Polulu board at 3.3V?

@2hgeng
Copy link
Author

2hgeng commented Aug 30, 2024

Yes it is at 3.3V, the Polulu board by default pulls it high.

@cparata
Copy link
Contributor

cparata commented Sep 2, 2024

Hi @2hgeng ,
are you sure about it? Giving a look at the schematics of the Pololu VL53L8CX board, it seems that the SPI_I2C_N pin is floating.
Best Regards,
Carlo
pololu_vl53l8cx_board

@cparata
Copy link
Contributor

cparata commented Sep 3, 2024

Hi @2hgeng ,
any update on this topic? Did you try to connect the SPI_I2C_N pin to Vdd in your hardware setup? It should be one of the 4 floating pins in the picture that you attached above.
Best Regards,
Carlo

@2hgeng
Copy link
Author

2hgeng commented Sep 3, 2024

Yes, it is connected to 3.3V power

@cparata
Copy link
Contributor

cparata commented Sep 3, 2024

Could you share a picture of your hardware setup and the software sketch that you are using?

@2hgeng
Copy link
Author

2hgeng commented Sep 6, 2024

Looks like the Pololu sensor breakout board is using a level shifter which is an issue. I am trying to get new board with new shifter and see if that works. I will keep you posted. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants