nrf52810 spi is not working.

Hello I have an nrf52810 custom board and in this board SPI is not work. When I try to use e-paper with SPI, SPI MOSI and SCK pins are not working.

I also tried nrf52840 board and in this board everything works fine.

Overlay for nrf52810: 

Overlay for nrf52840:

Complete Code :

#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
#include "../e_paper_lib/DEV_Config.h"
#include "../e_paper_lib/EPD_2in13_V3.h"
#include "../e_paper_lib/GUI_Paint.h"
#include "../e_paper_lib/ImageData.h"
#include <string.h>
#include <stdlib.h>

#define COLORED     0
#define UNCOLORED   1



#define MY_GPIO0 DT_NODELABEL(gpio1)
#define SPI0_NODE DT_NODELABEL(spi1)

const struct device *gpio0_dev = DEVICE_DT_GET(MY_GPIO0);
const struct device *spi0_dev = DEVICE_DT_GET(SPI0_NODE);
/*
SPI MOSI P012
SPI SCK P014
CS P09

*/
const struct spi_config spi_cfg = {

    .frequency = 4000000U, // 125000U : for slow mode

    .operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB | SPI_OP_MODE_MASTER};

int main(void)
{
    wait_for_gpio0_ready();
    int ret = gpio_pin_configure(gpio0_dev, EPD_CS_PIN, GPIO_OUTPUT);
    if (ret < 0)
    {
        printk("Error .. \n");
    }

    ret = gpio_pin_configure(gpio0_dev, EPD_DC_PIN, GPIO_OUTPUT);
    if (ret < 0)
    {
        printk("Error .. \n");
    }

    ret = gpio_pin_configure(gpio0_dev, EPD_RST_PIN, GPIO_OUTPUT);
    if (ret < 0)
    {
        printk("Error .. \n");
    }

    ret = gpio_pin_configure(gpio0_dev, EPD_BUSY_PIN, GPIO_INPUT);
    if (ret < 0)
    {
        printk("Error .. \n");
    }
 Debug("EPD_2in13_V3_test Demo\r\n");
    if(DEV_Module_Init()!=0){
        return -1;
    }

    Debug("e-Paper Init and Clear...\r\n");
    EPD_2in13_V3_Init();
    EPD_2in13_V3_Clear();

    //Create a new image cache
    UBYTE *BlackImage;
    UWORD Imagesize = ((EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1)) * EPD_2in13_V3_HEIGHT;
    if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
        Debug("Failed to apply for black memory...\r\n");
        return -1;
    }
    Debug("Paint_NewImage\r\n");
    Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
    Paint_Clear(WHITE);
 
    Debug("show image for array\r\n");
    Paint_SelectImage(BlackImage);
    Paint_Clear(WHITE);
    Paint_DrawBitMap(gImage_2in13);

    EPD_2in13_V3_Display(BlackImage);
    DEV_Delay_ms(2000);
    Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);    
    Debug("Drawing\r\n");
    //1.Select Image
    Paint_SelectImage(BlackImage);
    Paint_Clear(WHITE);
   
    // 2.Drawing on the image
    Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
    Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
    Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
    Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);

    Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
    Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
    Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
    Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);

    Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
    Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
    Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
    Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);

    Paint_DrawString_EN(140, 15, "test", &Font16, BLACK, WHITE);
    Paint_DrawNum(140, 40, 1998, &Font16, BLACK, WHITE);


    EPD_2in13_V3_Display_Base(BlackImage);
    DEV_Delay_ms(3000);



    Debug("Goto Sleep...\r\n");
    EPD_2in13_V3_Sleep();
    free(BlackImage);
    BlackImage = NULL;
    DEV_Delay_ms(2000);//important, at least 2s
    // close 5V
    Debug("close 5V, Module enters 0 power consumption ...\r\n");
    DEV_Module_Exit();

}


When I flash to the nrf52810 chip, I change spi1 and gpio1 to spi0 and gpio0. I also check the gpio pins for nrf52810 and pins work fine.

Thanks for your helps.
Related