Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Nothing works on ADC or DAC

The ADC-DAC Pi Zero is a 2 Channel ADC and 2 Channel DAC for the Raspberry Pi

09/08/2024

Posted by:
Toinou

Toinou Avatar

Hi, I tried the different demos founded on the github for the C library but nothing seems to work.
I tried also the tests and i get this :
Starting Test
open_adc(): PASSED
open_dac(): PASSED
set_dac_raw() channel 1: FAILED
read_adc_raw() channel 1: FAILED
set_dac_raw() channel 2: FAILED
read_adc_raw() channel 2: FAILED
set_dac_voltage() channel 1: FAILED
read_adc_voltage() channel 1: FAILED
set_dac_voltage() channel 2: FAILED
read_adc_voltage() channel 2: FAILED
read_adc_voltage() Differential Mode Channel 2 - 1: FAILED
read_adc_voltage() Differential Mode Channel 1 - 2: FAILED
close_adc(): PASSED
close_dac(): PASSED
One or more Tests FAILED

So the SPI is well enable on my rpi but the dac or the adc always has 0V.
I'm using a RPI 4 model B

09/08/2024

Posted by:
andrew

andrew Avatar

Hi

The ADC and DAC failing the tests suggests that it is a problem with either the SPI bus or the power going to the ADC DAC Pi.

Can you try disabling and re-enabling the SPI bus in raspi-config, just in case something went wrong when it was originally enabled? We have an SPI tutorial in our knowledge base that can help you with using raspi-config.

Try checking the 3.3V and GND pins on the ADC DAC Pi with a multimeter to make sure power is getting to the board.

You could also try checking the solder joints on the 40 pin GPIO header to make sure there are no dry joints or stray strands of solder bridging any of the pins.

09/08/2024

Posted by:
Toinou

Toinou Avatar

The ADC DAC Pi seems totally fine, i get the 3V3 and gnd. I think the problem come from the spi of the board itself, it is enabled but I don't know if its working do you have maybe a test I could do on my board without the ADC DAC Pi ?

09/08/2024

Posted by:
andrew

andrew Avatar

You could try running a loopback test by connecting the MOSI and MISO pins together and sending data between them.

I have uploaded a test program to our GitHub repository that should work for performing a loopback test.

spiloopback.c

Save the code as spiloopback.c and compile it using:

gcc -o spiloopback spiloopback.c

Remove the ADC DAC Pi and link the MOSI and MISO pins together with a jumper wire. MOSI and MISO are pins 19 and 21 on the GPIO header.

Run the program:

sudo ./spiloopback

If the SPI bus is working it should return:

SPI loopback test passed!

If it fails it will return:


SPI loopback test failed!
Sent: 0xAA 0x55 0xFF 0x00
Received: 0x00 0x00 0x00 0x00


If the test fails try setting up a clean installation of Raspberry Pi OS on a spare SD card, enable the SPI bus and run the test again on the new installation. That will allow you to narrow the issue down to being a software issue with Linux or a hardware issue with the Raspberry Pi.

13/08/2024

Posted by:
Toinou

Toinou Avatar

Thanks you, I tried your code on a new rpi OS and nothinf changed the test failed, so maybe the problem is from my board

13/08/2024

Posted by:
andrew

andrew Avatar

If the test code failed then it does sound like the issue may be the Raspberry Pi SPI hardware.

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout