peterhinch / micropython-vs1053

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

both async and sync players come up with "SyntaxError: invalid syntax" #2

Closed khvolk closed 1 year ago

khvolk commented 2 years ago

I just tried to run both demo player on a pyboard:

MicroPython v1.8.7-478-gbfb48c1 on 2017-03-24; PYBv1.1 with STM32F405RG

using Thonny IDE. With both players I am getting a: SyntaxError: invalid syntax on the first Statement of the vs1053.py (vs1053_syn.py) include file:

_INITIAL_BAUDRATE = const(1_000_000)

what am I doing wrong?

peterhinch commented 2 years ago

I can't replicate this with current firmware. On a Pyboard 1.1 I get

MPY: sync filesystems
MPY: soft reboot
MicroPython v1.18-56-g517e82eb6 on 2022-02-01; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> import vs1053_syn
>>> 

Your firmware is positively ancient. I recommend you update to the latest version (1.18) and try again.

khvolk commented 2 years ago

Thank you for your quick reply. In the meantime I got a little bit in touch with the Pyboard. Before I worked with ESP32 boards, only. My problems were not solved updating the software. They began.

I am using a VS1053 board which is booting up in Midi mode. So using your library yields is a lot of silence. I learned at https://github.com/Edzelf/ESP32-Radio to ask for the mode and how to switch to mp3 mode. For your library I have a work-around:

uncomment: _SCI_AUDATA = const(0x5)

at the end of _soft_reset: self._write_ram(0xc017, 3) self._write_ram(0xc019, 0) time.sleep_ms(100) print (" --> ", hex(self._read_reg(_SCI_AUDATA)))

This does not work very well. The first start of a script you see: --> 0xac45 ( = midi mode)

Stop, and a second run (in Thonny): --> 0x1f40 ( = mp3 mode)

an the player playbacks a mp3 song from the SD card. I tried different variations of this but did not find a better solution.

And worse: This does not work continuous. After 2 or 3 minutes the playback simply stops..

IMG_20220216_103819

peterhinch commented 2 years ago

As explained in the docs the driver was developed with this board. I'm sorry you're having problems, but I can't see a way for me to support hardware I don't possess.