Replies: 1 comment
-
Well for whatever magic reason, I decided one last time to run the SD_Test.ino and it worked, then out of desperation run the sd animation example and it worked. Don't know how or why. Its mind boggling when this happens because I didn't change the code. Ugh. I did notice that the schematic lacks pull up resistors to the makeshift I2C pins so maybe that's causing trouble even tho I'm not using the i2c clock on it at the moment. Idk. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an oddball hardware pin setup because I have an adapter board from Hackerbox (#65).
Thus I have pins I cannot change even tho they may not be ideal (or are they?) I'm stuck with the pins the way they are.
I will attach a wiring/board schematic.
Also, I'm using the latest Esp32 board definitions in Arduino 2.3.2 on an Esp-32 Dev (original one thats extra wide).
When I do most of the demos they run fine (except Aurora which gives compile errors and won't run :( ).
I even got the spiff version of animated.gif's to run (using an old 1.8 IDE to load .gif's onto spiff).
When I use my oddball pin setup with Arduino IDE's "SD_Test.ino" it works flawlessly.
Here's the catch, when I try to use AnimatedGifPanel_SD.ino demo - using the same HUB pinout as all of the other demo's, and using the same SD card pinout I use in Arduino's own SD_Test example - catastrophe.
I've lost a number of errors in the fight, but for some unknown reason I get card mount failed error. (?!) How is that possible when the pins don't conflict with the HUB pins and though the software and libraries are outdated, anyone can google Hackerbox 65 and see their esp/panel/sd card combo worked with same pins (just different libraries).
This is killing me I've been at it for 2 days and can't figure it out. I've even started loading parts of SD_Test.ino into 1_Simple_Test_Shapes.ino demo - and the panel does its thing but I still get the serial error and oddly enough I pasted the SPI/SD code straight from the working SD_Test.ino from Arduino. UGH.
Anyway here's the hardware schematic:
I hate to post such a big chunk of code but here it is anyway.
PS: I've searched through the discussions here and did see the thread how everyone got their sd card to work, that's how I came to mapping my SPI pins the way I did to match my board schematic. Any help would be greatly appreciated.
Thanks in advance!
/*********************************************************************
********************************************************************/
#include "FS.h"
#include "SD.h"
#include "SPI.h"
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#include <AnimatedGIF.h>
/********************************************************************
*/
/*
*/
// SPIClass spi(HSPI);
/**** HUB75 GPIO mapping ***/
// GPIO 34+ are on the ESP32 are input only!!
// https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
/
#define A_PIN 33 // remap esp32 library default from 23 to 33
#define B_PIN 32 // remap esp32 library default from 19 to 32
#define C_PIN 22 // remap esp32 library defaultfrom 5 to 22
*/
//#define R1_PIN 25 // library default for the esp32, unchanged
//#define G1_PIN 26 // library default for the esp32, unchanged
//#define B1_PIN 27 // library default for the esp32, unchanged
//#define R2_PIN 14 // library default for the esp32, unchanged
//#define G2_PIN 12 // library default for the esp32, unchanged
//#define B2_PIN 13 // library default for the esp32, unchanged
//#define D_PIN 17 // library default for the esp32, unchanged
//#define E_PIN -1 // IMPORTANT: Change to a valid pin if using a 64x64px panel.
//#define LAT_PIN 4 // library default for the esp32, unchanged
//#define OE_PIN 15 // library default for the esp32, unchanged
//#define CLK_PIN 16 // library default for the esp32, unchanged
// This config is for Hackerbox #65
#define R1_PIN 2
#define G1_PIN 15
#define B1_PIN 4
#define R2_PIN 16
#define G2_PIN 27
#define B2_PIN 17
#define A_PIN 5
#define B_PIN 18
#define C_PIN 19
#define D_PIN 21
#define E_PIN 12 // required for 1/32 scan panels, like 64x64px. Any available pin would do, i.e. IO32 - Also required for chaining panels
#define LAT_PIN 26
#define OE_PIN 25
#define CLK_PIN 22
HUB75_I2S_CFG::i2s_pins _pins={R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN};
/**** SD Card GPIO mappings for HACKERBOX 65 ****/
#define CLK_PIN 32
#define MISO_PIN 34
#define MOSI_PIN 33
#define SS_PIN 23
SPIClass spi = SPIClass(HSPI);
/***************************************************************
**************************************************************/
#define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module.
#define PANEL_CHAIN 1 // Total number of panels chained one to another
/**************************************************************/
AnimatedGIF gif;
MatrixPanel_I2S_DMA *dma_display = nullptr;
static int totalFiles = 0; // GIF files count
static File FSGifFile; // temp gif file holder
static File GifRootFolder; // directory listing
std::vectorstd::string GifFiles; // GIF files path
const int maxGifDuration = 30000; // ms, max GIF duration
#include "gif_functions.hpp"
#include "sdcard_functions.hpp"
/**************************************************************/
void draw_test_patterns();
int gifPlay( const char* gifPath )
{ // 0=infinite
if( ! gif.open( gifPath, GIFOpenFile, GIFCloseFile, GIFReadFile, GIFSeekFile, GIFDraw ) ) {
log_n("Could not open gif %s", gifPath );
}
Serial.print("Playing: "); Serial.println(gifPath);
int frameDelay = 0; // store delay for the last frame
int then = 0; // store overall delay
while (gif.playFrame(true, &frameDelay)) {
}
gif.close();
return then;
}
void setup()
{
Serial.begin(115200);
// mxconfig.gpio.d = D_PIN;
// This is important - Set the right endianness.
gif.begin(LITTLE_ENDIAN_PIXELS);
}
void loop(){
}
void draw_test_patterns()
{
// fix the screen with green
dma_display->fillRect(0, 0, dma_display->width(), dma_display->height(), dma_display->color444(0, 15, 0));
delay(500);
// draw a box in yellow
dma_display->drawRect(0, 0, dma_display->width(), dma_display->height(), dma_display->color444(15, 15, 0));
delay(500);
// draw an 'X' in red
dma_display->drawLine(0, 0, dma_display->width()-1, dma_display->height()-1, dma_display->color444(15, 0, 0));
dma_display->drawLine(dma_display->width()-1, 0, 0, dma_display->height()-1, dma_display->color444(15, 0, 0));
delay(500);
// draw a blue circle
dma_display->drawCircle(10, 10, 10, dma_display->color444(0, 0, 15));
delay(500);
// fill a violet circle
dma_display->fillCircle(40, 21, 10, dma_display->color444(15, 0, 15));
delay(500);
delay(1000);
}
Beta Was this translation helpful? Give feedback.
All reactions