SPI Flash with an MP3 chip - Page 1
Forum section: electronics / beginners

author: Mungo9000
author_rank: Newbie
timestamp: September 10, 2021, 03:36:48 pm
content: Hi, I’m trying to build an electronic toy and need to connect a YX5200 mp3 player to SPI flash memory. (This MP3 chip is the same as the popular DFplayer MP3 module).The MP3 player has the option to get music data from either an SD card, or SPI flash and I’ve managed to get it working with the SD card. But my problem is I don’t understand the SPI connections between the two chips. I understand how SPI works, with MISO, MOSI, a Clock and Chip Enable pins, but the MP3 player is using something called “SPI DO” and despite scouring the internet, I can’t figure this out.The MP3 chip has 3 pins: Clock, Chip-Select, and SPI DOMy Flash memory has 4 pins: Clock, Chip-Select, Slave Input and Slave Output.In the schematics from the Chinese manufacturer, the Flash input and output are joined through a 100 ohm resistor which leads me to believe SPI DO works as both Input and Output, but the project isn’t working and I cannot find online resources to learn about SPI DO.The only thing I don’t understand is how these two chips connect. Which pins connect to which?If anyone can point me to learning resources or help me with this problem, I’d be truly thankful.There was a very similar problem on this forum before:https://www.eevblog.com/forum/microcontrollers/mp3-files-on-spi-flash-for-yx5200-24ss-mp3-chip/Potential issues:File formatting: My files are in FAT format.Coding: I feel confident my code is asking for Flash data, not SD card dataMemory chip: My Flash memory is an SST26VF016B, which is a 26xx series rather than 25xx, however, the datasheet states that the chip is fully backwards compatible with 25xx series SPI and is in 25xx SPI mode by default when it powers on.

author: mikerj
author_rank: Super Contributor
timestamp: September 10, 2021, 05:09:48 pm
content: The schematic looks reasonable. The SO and SI signals on the slave device (flash) are connected together via a resistor. The master device configures it's DO pin as an output to to write data to the SI pin on the slave, the SO pin should be high impedance at this point, though the resistor helps to ensure no bus collisions. To read back, the DO pin is configured as an input and the data clocked out from SO is fed into both SI and DO. The flash device will ignore the data on it's SI pin in this state.Connecting MISO and MOSI together used to be a relatively common thing if only half duplex comms was needed, though I don't see it done so much now.

author: Mungo9000
author_rank: Newbie
timestamp: September 10, 2021, 06:02:42 pm
content: That's what I suspected, but I can't find any documentation on it.The project still doesn't work when connected that way, but it means one less "integration hell" problem.Thank you for your insight.

author: mikerj
author_rank: Super Contributor
timestamp: September 10, 2021, 08:30:33 pm
content: Are you getting any activity on the SPI bus? I'm not familiar with this device, but looking through the datasheet it shows a serial comms link that can be used to configure the device and also a bunch of switches connected to the "ADKEY" inputs each with a different value of resistor, one of which selects the storage type. Do you have either of these set up?

author: Mungo9000
author_rank: Newbie
timestamp: September 11, 2021, 12:47:23 am
content: Brilliant SuggestionThe moment I read your post I remembered seeing something about ADKEY1, ADKEY2 in one of the bad translations of the schematics. Because the memory card wasn't affected, I didn't think the SPI would be. (It's too late to work now, but this gives my weekend some focus).This translation, very bottom right: