I have been trying for quite a while to interface a VS1053 mp3 decoder board with a TTGO T-Display board (ESP32 development board with a built in TFT display). Although I have seen reports of successfully interfacing with an SD card board with the TTGO, nowhere can I find anyone who has done it with a VS1053. The problem appears to be that the VSPI bus is used for the TTGO display and using the HSPI to connect to the VS1053 is difficult.
Below is the section of code where I've tried to connect the HSPI bus to the VS1053. It doesn't work. What am I missing?
(I will be glad to post the entire code if it would help)
Any help sincerely appreciated !!!!!!
#include <SPI.h> // Serial Peripheral Interface
#include <EEPROM.h> // Allows reads and writes to EEPROM
#include <VS1053.h> // Library for VS1053
//#include "VS1053_ext.h"
#include <WiFi.h> // Enables network connection can eliminate if using wifimanager ??
#include <HttpClient.h>
#include <TFT_eSPI.h>
#include "driver/rtc_io.h"
#include <DNSServer.h>
#include <WebServer.h>
//#include <WiFiManager.h>
TFT_eSPI tft = TFT_eSPI(); // Invoke graphics library, pins defined in User_Setup.h
// initialize SPI bus;
SPIClass mySPI(HSPI);
// Wiring of VS1053 board
//MISO-master in slave out MOSI-master out slave in SCK-serial clock
//CS-chip select DCS-data command select DREQ-data request interupt
//VS1053 player(VS1053_CS, VS1053_DCS, VS1053_DREQ);
VS1053 player(33, 32, 2);
*/
void setup () //========================== Setup ==========
{
// initialize SPI HSPI bus
mySPI.begin(25, 27, 26, 33); // clock,MISO,MOSI,CS
Using the HSPI bus on the TTGO Display board
-
- Posts: 1
- Joined: Wed Oct 19, 2022 9:02 pm
Re: Using the HSPI bus on the TTGO Display board
You are not the only one with this problem. I have tried your approach and several others but still can not use HSPI
Code: Select all
/* Test the VS1053 with simple click player
*/
#include <Arduino.h>
#include "VS1053.h"
#include <SPI.h>
#include "clickMP3.h"
// pin definitions
// VS1053 Audio file player
#define VS1053_MISO 12
#define VS1053_MOSI 13
#define VS1053_SCLK 15
#define VS1053_CS 22
#define VS1053_DCS 21
#define VS1053_DREQ 2
#define VS1053_RST 17
// constants
const int CHUNKSZ = 32;
SPIClass SPIH(HSPI);
// Player object
VS1053 player(VS1053_CS, VS1053_DCS, VS1053_DREQ, VS1053_RST); // uses HSPI?
// function definitions
void mp3_sample()
{
int szt = sizeof(sampleMp3);
player.startSong();
// breakup into chunks
for(int i = 0; i < szt; i += CHUNKSZ){
player.playChunk( &sampleMp3[i], CHUNKSZ);
while(player.playStatus() == false){ // wait while buffer full
Serial.print("!");
}
}
player.stopSong();
delay(3000);
}
void setup() {
Serial.begin(112500);
delay(3000);
Serial.println("Starting VS1053 Test");
// Audio player setup
Serial.println("Setup: VS1053");
SPIH.begin(VS1053_SCLK, VS1053_MISO, VS1053_MOSI, -1); // VS1053 controls
pinMode(VS1053_CS, OUTPUT); // Non-standard ChipSelect
player.begin();
Serial.println("VS1053 begin");
if( !player.isChipConnected()) {
player.printDetails("Startup Failed");
}
player.switchToMp3Mode();
player.setVolume(50);
Serial.println("Player ready");
}
void loop() {
mp3_sample(); // play click
}
Who is online
Users browsing this forum: asargent, Bing [Bot] and 69 guests