Skip to content

Commit

Permalink
Add simple PCB tester script (soldering)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Nov 10, 2023
1 parent db941ac commit 986bd26
Show file tree
Hide file tree
Showing 6 changed files with 1,588 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/v7-pcb-tester/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.16.0)
set(EXTRA_COMPONENT_DIRS "../../")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(pcb_tester)
10 changes: 10 additions & 0 deletions examples/v7-pcb-tester/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PCB tester
==========

This PCB tester is just a simple script that will iterate first the data lines (0 to 15) in a sequencial mode.
Then it will light all of them at the same time and turn it down.
And then as latest step will do the same with the signals.

That way you can discover in a simple way if there is any bridge in your soldering, either in MCU or in the FPC connectors, without the need to connect a display.

The PCB you can find in the [vroland.github.io/epdiy-hardware](https://vroland.github.io/epdiy-hardware) open source files. But you can also do it yourself with a 40 pin expander breakout and soldering the Leds+ Resistances manually.
3 changes: 3 additions & 0 deletions examples/v7-pcb-tester/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(app_sources "main.c")

idf_component_register(SRCS ${app_sources} REQUIRES epdiy)
86 changes: 86 additions & 0 deletions examples/v7-pcb-tester/main/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* Simple firmware to turn HIGH and Low sequencially the Data and Signals for controlling epaper
* displays */
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "epdiy.h"

#include <driver/gpio.h>

#define D15 GPIO_NUM_47
#define D14 GPIO_NUM_21
#define D13 GPIO_NUM_14
#define D12 GPIO_NUM_13
#define D11 GPIO_NUM_12
#define D10 GPIO_NUM_11
#define D9 GPIO_NUM_10
#define D8 GPIO_NUM_9

#define D7 GPIO_NUM_8
#define D6 GPIO_NUM_18
#define D5 GPIO_NUM_17
#define D4 GPIO_NUM_16
#define D3 GPIO_NUM_15
#define D2 GPIO_NUM_7
#define D1 GPIO_NUM_6
#define D0 GPIO_NUM_5

/* Control Lines */
#define CKV GPIO_NUM_48
#define STH GPIO_NUM_41
#define LEH GPIO_NUM_42
#define STV GPIO_NUM_45
/* Edges */
#define CKH GPIO_NUM_4

gpio_num_t data_bus[] = {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15};

gpio_num_t signal_bus[] = {CKV, STH, LEH, STV, CKH};

void idf_loop() {
// Sequence data GPIOs
for (int x = 0; x < 16; x++) {
printf("IO:%d\n", (int)data_bus[x]);
gpio_set_level(data_bus[x], 1);
vTaskDelay(pdMS_TO_TICKS(100));
gpio_set_level(data_bus[x], 0);
vTaskDelay(pdMS_TO_TICKS(20));
}
vTaskDelay(pdMS_TO_TICKS(800));

// Sequence signal GPIOs
for (int x = 0; x < 5; x++) {
gpio_set_level(signal_bus[x], 1);
vTaskDelay(pdMS_TO_TICKS(200));
gpio_set_level(signal_bus[x], 0);
vTaskDelay(pdMS_TO_TICKS(20));
}
vTaskDelay(pdMS_TO_TICKS(800));
}

void idf_setup() {
// If we do not instance epdiy then we should declare all the Data and signals as OUTPUT
epd_init(&epd_board_v7, &ED078KC1, EPD_LUT_64K);

epd_set_vcom(1560);

// Sequence data GPIOs
// Initialize GPIOs direction & initial states
printf("Set all IOs output\n\n");
for (int x = 0; x < 16; x++) {
gpio_set_direction(data_bus[x], GPIO_MODE_OUTPUT);
}
for (int x = 0; x < 5; x++) {
gpio_set_direction(signal_bus[x], GPIO_MODE_OUTPUT);
}
}

#ifndef ARDUINO_ARCH_ESP32
void app_main() {
idf_setup();

while (1) {
idf_loop();
};
}
#endif
30 changes: 30 additions & 0 deletions examples/v7-pcb-tester/main/main.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* This is the Arduino wrapper for the "Demo" example.
* Please go to the main.c for the main example file.
*
* This example was developed for the ESP IoT Development Framework (IDF).
* You can still use this code in the Arduino IDE, but it may not look
* and feel like a classic Arduino sketch.
* If you are looking for an example with Arduino look-and-feel,
* please check the other examples.
*/

// Important: These are C functions, so they must be declared with C linkage!
extern "C" {
void idf_setup();
void idf_loop();
}

void setup() {
if (psramInit()) {
Serial.println("\nThe PSRAM is correctly initialized");
} else {
Serial.println("\nPSRAM does not work");
}

idf_setup();
}

void loop() {
idf_loop();
}
Loading

0 comments on commit 986bd26

Please sign in to comment.