Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5288

Compute Module • CM4 SPI issues with MikeM's bcm2835 lib

$
0
0
Hi all,

I'm using the latest version of the lib from: https://raspberry-projects.com/pi/progr ... e-mccauley
The CM4 Lite is on a rPi "Compute Module 4 IO Board".

I've written a very simple C util to communicate with my device (spi slave).
Watching MISO/MOSI/CK/CS on a DSO, everything looks fine. Data is sent to my device on MOSI, and the device sends data back on MISO.

Code:

bcm2835_init();bcm2835_spi_begin();bcm2835_spi_setChipSelectPolarity(BCM2835_SPI_CS0, 0);bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_512);bcm2835_spi_setDataMode(BCM2835_SPI_MODE0);bcm2835_spi_chipSelect(BCM2835_SPI_CS0);...uint8_t data_out[16] = "hello world 1234";uint8_t data_in[16] = {0};bcm2835_spi_transfernb((char*)data_out, (char*)data_in, sizeof(data_out));
The problem is data_in[] is always full of 0xFF.
I've tried directly connecting MISO to GND, but that make no difference.

Has anyone come across this?

Thanks.

Statistics: Posted by MWP — Thu Feb 08, 2024 8:26 am



Viewing all articles
Browse latest Browse all 5288

Trending Articles