Page 1 of 1

nrf52 master VS1053 slave

Posted: Sat 2022-05-14 1:12
by cbrisebois

I am trying to establish my nrf52840 chip as master over the VS1053b to enable audio recording and playback features in my device. I am having trouble confirming initialization of the VS1053b. Specifically, when I preform a read operation for the serial command interface (SCI) I receive either no signal or garbage on the slave out (MISO) line. I have written my board specific driver for the VS1053 chip according the instructions as presented in two documents published by VSLI solutions, "VS10XX APPNOTE: CONNECTING SPI BUSES" and "VS1053 APPNOTE: PLAYBACK AND RECORDING". Below are snips of code regarding, a sample SCI write/read sanity check, my SPI initialization, and my WriteSCI function. I am using the 7-pin topology outlined in "VS10XX APPNOTE: CONNECTING SPI BUSES" (I have triple checked wiring).

/*** sample SCI read/write sanity check ***/
uint16_t sci_mode = ReadSci(SCI_MODE);

/*** SPI initialization ***/
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
spi_config.sck_pin = SPI_SCK_PIN;
spi_config.miso_pin = SPI_MISO_PIN;
spi_config.mosi_pin = SPI_MOSI_PIN;
spi_config.ss_pin = SPI_MCS_PIN;
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL));

/*** WriteSCI ***/
void WriteSci(uint8_t addr, uint16_t data) {
uint8_t m_tx_buf[] = {SCI_WRITE_FLAG, addr, (uint8_t)(data >> 8), (uint8_t)(data & 0xFF)};
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf,sci_write_len, NULL, 0));

I have confirmed that the data sent over the SI (MOSI) line is correct with my oscilloscope. Please let me know if you see anything glaringly wrong, I'm pretty novice so I'm hoping my issue has a pretty simple fix.


Re: nrf52 master VS1053 slave

Posted: Sat 2022-05-14 11:44
by pasi
The first things to check are that
- You don't have xCS and xDCS asserted (low) at the same time.
- xTEST is pulled high or connected to IOVDD.
- The SPI clock speed is low enough with the correct clock polarity.

After reset you should get values from SCI_MODE, SCI_STATUS, and SCI_AUDATA without needing to write.

See the recent thread: viewtopic.php?f=11&t=2950 , maybe some of your issues are similar.

Where are you setting sci_write_len in SciWrite? If you have issues with SciRead(), what does it look like?

Re: nrf52 master VS1053 slave

Posted: Mon 2022-05-16 21:10
by cbrisebois
Hello, thank you for the reply.

I checked my assertions of xCS and xDS and re-timed them to reflect the VS1053b datasheet. I also slowed the clock speed. This fixed my problem and I can read/write to the chip's registers as desired. Thank you for your recommendations.