Steps to Debug the IssueHi,
WiringPi CM4 SPI support is very new and the hardware is not included in the unit tests yet, so bugs may still be present.
What I don't understand is, have you tried to replace wiringPiSPISetupMode with wiringPiSPIxSetupMode? The error message suggests you should do that.
The SPI channel is not SPI1; it's SPI0 CE/CS1! The old version 2.x could only access SPI0.
With wiringPiSPIxSetupMode, you can access SPI1 CS1:Code:
wiringPiSPIxSetupMode(1, 1, 500000, 0);
Verify wiringPiSPIxSetupMode Usage
Ensure you replaced wiringPiSPISetupMode in your MAX5144.cpp file with:
Code:
if (wiringPiSPIxSetupMode(spiChannel, 1, 500000, 0) < 0) { throw std::runtime_error("SPI initialization failed!");}Clean and Rebuild Again
Run the following commands to ensure no residual files are causing issues:
bash
Copy code
rm -rf build
mkdir build
cd build
cmake ..
make
Statistics: Posted by dgy411852 — Wed Jan 15, 2025 10:28 pm