I have a Polaris NB IoT board on which I have an SD card that contains an MP3 file. I am trying to play said file on an MP3Click using SPI communication. I am using Python to code my board. I am able to write to the MP3 Click using this function and can read the data I send from a similar function.
def write_register(register, value):
high_byte = (value >> 8) & 0xFF
spi.select()
low_byte = value & 0xFF
spi.write(bytearray([SCI_WRITE, register, high_byte, low_byte]))
spi.unselect()
However when I try to write my byte data from my MP3 file there is no sound being played. Why might this be? I am certain the MP3 file has data.
DREQ_PIN = D0 # Data request pin
pinMode(DREQ_PIN,INPUT_PULLUP)
RESET_PIN = D1 # Reset pin
SCI_MODE = 0x00
SCI_VOL = 0x0B
SCI_STATUS = 0x01
SCI_WRAM = 0x06
SCI_WRAMADDR = 0x07
SCI_READ = 0x03
SCI_WRITE = 0x02
SM_STREAM = 0x08
spi = spi.Spi(D2, clock=1000000, bits=spi.SPI_8_BITS, mode=spi.SPI_MODE_LOW_FIRST)
def send_mp3_data(register, data):
while digitalRead(DREQ_PIN) == LOW:
sleep(100) # Wait until DREQ is high
spi.select()
spi.write(data)
spi.unselect()
def play_mp3(filename):
mp3_file = os.open(filename, 'rb+')
while True:
# Wait for DREQ to go high
while digitalRead(DREQ_PIN) == LOW:
soft_reset_vs1053()
sleep(10)
data = mp3_file.read(32)
if not data:
print("EOF")
break # End of file
# Send the data chunk to VS1053B
send_mp3_data(SCI_WRITE,data)
print("Playback finished")
I have tried plugging both a wired in ear headset into the headphone jack and an amplifier connected to a speaker. The in ear headset makes no noise at all while the speaker is constantly buzzing loudly, also while no data is being sent. I have attached an image of my board layout. The MP3 Click is inserted into the micro bus of the board. 