peterhinch / micropython-vs1053

Synchronous and asynchronous drivers for VS1053b MP3/FLAC player
MIT License
24 stars 7 forks source link

issue with while not self._dreq() #7

Closed microplasticos closed 6 months ago

microplasticos commented 6 months ago

Hello,

I'm trying to connect the following board to a Raspberry Pi Pico, and I'm encountering the following error when trying to create the player object with the VS1053 class:

Traceback (most recent call last):
  File "<stdin>", line 29, in <module>
  File "vs1053_syn.py", line 105, in __init__
  File "vs1053_syn.py", line 237, in reset
  File "vs1053_syn.py", line 241, in soft_reset
  File "vs1053_syn.py", line 305, in mode_set
  File "vs1053_syn.py", line 302, in mode
  File "vs1053_syn.py", line 134, in _read_reg
  File "vs1053_syn.py", line 118, in _wait_ready

When tracing the origin of the error, I arrive at this method in the VS1053 class in the vs1053.py file

    def _wait_ready(self):
        self._xdcs(1)
        self._xcs(1)
        while not self._dreq():  #the code stucks on this loop
            pass

When testing the shield on an Arduino Uno (using adafruit libraries) , it works fine. However, when attempting to integrate the board with the Pico, I get this error, which I believe is associated with the DREQ pin output. What could it be? I've checked the connections 3, 4, 5 times, so I don't think that's the issue. I understand that the signal of that pin is generated by the chip when it's ready, but I don't think the issue is hardware-related since it worked fine on Arduino.

I'm attaching a photo of the shield I'm using.

image

Btw, I've tried both asynchronous and synchronous modes, and in both cases, I get the same error; it fails to create the player object.

Can you guide me, please? Thank you.

peterhinch commented 6 months ago

The code is waiting for the dreq pin to go high. Either the Pin object was not instantiated correctly as an input, or the hardware is not asserting the signal, or the electrical state of the connection is tied to Gnd in some way. You could check the state of the pin with a voltmeter.

microplasticos commented 6 months ago

It was a bad connection, I'm closing this thread. Thanks!