I found solution in "rtmidi.pdf" (VS10XX REAL-TIME MIDI INPUT doc):
"After the code is loaded, it is started by writing 0x30 to SCI_AIADDR (0x50 for vs1053b)"
My plugin has " 0x000a, 0x0001, 0x0050" at the end (need 0x0030 instead 0x0050 - because my chip is vs1003b). I tried other plugins but other has not writes to 0x000a register at all!
Anyway Thanks Pasi for email answer earlier!
Hi!
I have previously emailed Pasi about similar issue and got detailed answer. Thanks Pasi for answer and refernce to this forum!
See this fresh topic: viewtopic.php?t=3230
but decided to create a separate one as the conditions and environment may differ slightly (sorry if this is not accepted)
My task:
I want to play very simple real-time MIDI sample (one note demo) with vs1003b using only SPI (SCI/SDI)
My mc: ESP32
My dev environment: no arduino, only ESP-IDF sdk + C; SPI; USB powered
My last problem:
I got ratchet sound after sending more than 6 bytes over SDI to vs1003b with real-time MIDI patch loaded
Last problem solving:
I load patch over SCI with wrong high-low byte sequence
My current problem:
Now I don't hear anything, just silence with any settings and MIDI commands
Important note:
MP3 decoding works fine with same environment - I hear the song without distortion
My questions and possible causes of the problem:
1. I see main settings registers that have the most impact for vs1003 + rtmidi case:
MODE, CLOCKF, AUDATA, VOL (and some secondary: STATUS (write-mode), BASS, DECODE_TIME)
And I has two main events before playing MIDI commands:
- Set MODE with software reset (and with SM_SDINEW)
- Loading real-time MIDI patch
At what point should I set these registers? Some settings before reset? Some between reset and patch loading? Or some/all after reset and patch loading? What values should I use for simple demo? Pasi told me in email MODE can be just default 0x800 - is it really enough for easy demo? Also he told me CLOCKF "allows higher polyphony and effect". Is default values of MODE (ox800) CLOCKF (0x0) enough for demo? What about other registers (AUDATA, VOL)? Can incorrect (or default) values for these settings cause my problem? What a minimal set of required pairs of register-value for my demo case (with any quality)?
2. Should I set special SPI bus speed for this case? Can I use 1 MHz for SPI bus speed in SCI initialization and SDI playing parts?
If default value of CLKI is 12.288 MHz - should I change SPI bus speed to correspond this CLKI?
3. Could the problem be related to the power level?
I power the vs1003 with 3v3 from ESP32 power output pin (works fine for mp3 decoding)
4. Could the problem be related to the lack of pull-up resistor for some pins connected to my ESP32?
All pins connected to ESP32 directly
5. What a minimal demo commands set?
I mean real super minimal set of commands to play at least on note. Is single note-on command (0x90) enough to play this note or this case required any settings with MIDI commands before it?
6. I saw it before and also in the new topic (viewtopic.php?t=3230) about MIDI baudrate (31250 Hz). Should I apply this value to any setting?
7. Any other problems?
Also I would be very grateful for a mini review of my code (only logic part ofc)
I attach my code with implementations of base functions:
vs1003_write_sci, vs1003_write_sdi, vs1003_init, vs1003_midi_init, vs1003_midi_write
In my example I use this functions in main.c like this:
Code: Select all
vs1003_init
vs1003_midi_init
// vs1003_midi_write(0xB0, ...) // settings
vs1003_midi_write(0x90, note, vel)
delay
vs1003_midi_write(0x80, note, vel)
Code: Select all
Read [VS1003_MODE_REG]: [0x800]
Read [VS1003_STATUS_REG]: [0x30]
Read [VS1003_BASS_REG]: [0]
Read [VS1003_CLOCKF_REG]: [0]
Read [VS1003_DECODE_TIME_REG]: [0]
Read [VS1003_AUDATA_REG]: [0x1f40]
Read [VS1003_WRAMADDR_REG]: [0]
Read [VS1003_VOL_REG]: [0]
Code: Select all
const unsigned short gVS1053_MIDI_Patch[28] = {
/*if you don't let GPIO1 = H,please send this patch by spi*/
0x0007, 0x0001, 0x8050, 0x0006, 0x0014, 0x0030, 0x0715, 0xb080, /* 0 */
0x3400, 0x0007, 0x9255, 0x3d00, 0x0024, 0x0030, 0x0295, 0x6890, /* 8 */
0x3400, 0x0030, 0x0495, 0x3d00, 0x0024, 0x2908, 0x4d40, 0x0030, /* 10 */
0x0200, 0x000a, 0x0001, 0x0050
};
Thanks in advance for any response!