ESP32 1.54inch e-Paper Module B (Waveshare) - Error on spi_bus_initialize
Posted: Mon May 13, 2019 11:50 am
Hello, we are 2 engineering students who are doing an IoT project for our studies. It is a network of temperature and brightness sensors where the values will be displayed on an e-paper screen. We use esp32 devkitC-V4 and I try to command the 1"54inch e-paper display version B (with black and red color) from Waveshare.
We tried to compile the code from this GitHub link : https://github.com/ayoy/esp32-waveshare-epd ; which supports 1.54" EPD version B.
This is the main file (epd_example_main.cpp) :
This is epdif.h :
We tried to compile this code on my terminal but we have this error on the SPI bus :
E (322) spi_master: spi_bus_initialize(236): intr flag not allowed
E (328) EPDIF: INVALID ARG
We have updated the esp-IDF and reinstalled the Toolchain but the error persists. Do you have any idea where this error may come from? We are really stuck so any help would be helpful, thank you in advance for your answers!
We tried to compile the code from this GitHub link : https://github.com/ayoy/esp32-waveshare-epd ; which supports 1.54" EPD version B.
This is the main file (epd_example_main.cpp) :
Code: Select all
/**
* @filename : epd1in54-demo.ino
* @brief : 1.54inch e-paper display demo
* @author : Yehui from Waveshare
*
* Copyright (C) Waveshare September 5 2017
*/
#include "epd1in54b.h"
#include "epdpaint.h"
#include "imagedata.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/timer.h"
static const char * kEPDTAG = "EPD";
#define COLORED 0
#define UNCOLORED 1
extern "C" void app_main() {
Epd epd;
if (epd.Init() != 0) {
ESP_LOGE(kEPDTAG, "e-Paper init failed");
vTaskDelay(2000 / portTICK_RATE_MS);
return;
}
ESP_LOGE(kEPDTAG, "e-Paper initialized");
unsigned char* frame_black = (unsigned char*)malloc(epd.width * epd.height / 8);
unsigned char* frame_red = (unsigned char*)malloc(epd.width * epd.height / 8);
Paint paint_black(frame_black, epd.width, epd.height);
Paint paint_red(frame_red, epd.width, epd.height);
paint_black.Clear(UNCOLORED);
paint_red.Clear(UNCOLORED);
/* Draw something to the frame buffer */
/* For simplicity, the arguments are explicit numerical coordinates */
paint_black.DrawRectangle(10, 60, 50, 110, COLORED);
paint_black.DrawLine(10, 60, 50, 110, COLORED);
paint_black.DrawLine(50, 60, 10, 110, COLORED);
paint_black.DrawCircle(120, 80, 30, COLORED);
paint_red.DrawFilledRectangle(10, 130, 50, 180, COLORED);
paint_red.DrawFilledRectangle(0, 6, 200, 26, COLORED);
paint_red.DrawFilledCircle(120, 150, 30, COLORED);
/*Write strings to the buffer */
paint_black.DrawStringAt(30, 30, "e-Paper Demo", &Font12, COLORED);
paint_red.DrawStringAt(28, 10, "Hello world!", &Font12, UNCOLORED);
/* Display the frame buffer */
epd.DisplayFrame(frame_black, frame_red);
/* Display the image buffer */
epd.DisplayFrame(IMAGE_BLACK, IMAGE_RED);
}
This is epdif.h :
Code: Select all
#ifndef EPDIF_H
#define EPDIF_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "driver/spi_master.h"
#include "soc/gpio_struct.h"
#include "driver/gpio.h"
#define MOSI_PIN GPIO_NUM_27
#define CLK_PIN GPIO_NUM_26
#define CS_PIN GPIO_NUM_25
#define DC_PIN GPIO_NUM_33
#define RST_PIN GPIO_NUM_32
#define BUSY_PIN GPIO_NUM_35
class EpdIf {
public:
EpdIf(void);
~EpdIf(void);
static int IfInit(void);
static void DigitalWrite(gpio_num_t pin, int value);
static int DigitalRead(gpio_num_t pin);
static void DelayMs(unsigned int delaytime);
static void SpiTransfer(unsigned char data);
};
#endif
We tried to compile this code on my terminal but we have this error on the SPI bus :
E (322) spi_master: spi_bus_initialize(236): intr flag not allowed
E (328) EPDIF: INVALID ARG
We have updated the esp-IDF and reinstalled the Toolchain but the error persists. Do you have any idea where this error may come from? We are really stuck so any help would be helpful, thank you in advance for your answers!