SPI Pins for nRF52840 DK to use with ePaper driver code?

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
KKaushik
 
Posts: 18
Joined: Mon Jul 11, 2022 6:54 am

SPI Pins for nRF52840 DK to use with ePaper driver code?

Post by KKaushik »

I'm using nRF52840DK https://www.nordicsemi.com/Products/Dev ... rf52840-dk with Adafruit EPD driver code : https://github.com/adafruit/Adafruit_EPD

The pins I used are

Code: Select all

#define EPD_CS      4//P0.4
#define EPD_DC      3//P0.3
#define SRAM_CS     -1
#define EPD_RESET   2 //P0.2
#define EPD_BUSY    5 //P0.5 
I have used these settings first
Arduino Settings.png
Arduino Settings.png (28.03 KiB) Viewed 470 times
The code works fine with Adafruit Bluefruit nRF52832, https://www.adafruit.com/product/3406 as there are pins mentioned on the board to use for MOSI(P0.13) and DIN(P0.12).

Steps for flashing code in nRF52840DK
1. Erase All: using nRF Programmer
2. Burn Bootloader: J-Link Bluefruit nRF52 (successfully)
I have tried burning the bootloader: Bootloader DFU for nRF52 and got the below error.

Code: Select all

ouched serial port COM9
Opened serial port COM9
Starting DFU upgrade of type 3, SoftDevice size: 147792, bootloader size: 21704, application size: 0
Sending DFU start packet
Timed out waiting for acknowledgement from device.

Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.
Traceback (most recent call last):
  File "__main__.py", line 296, in serial
  File "dfu\dfu.py", line 226, in dfu_send_images
  File "dfu\dfu.py", line 199, in _dfu_send_image
  File "dfu\dfu_transport_serial.py", line 179, in send_start_dfu
  File "dfu\dfu_transport_serial.py", line 243, in send_packet
  File "dfu\dfu_transport_serial.py", line 282, in get_ack_nr
nordicsemi.exceptions.NordicSemiException: No data received on serial port. Not able to proceed.

Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- Baud rate must be 115200, Flow control must be off.
- Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.
With J-link for Bluefruit nRF52
3. Uploading code successfully.

Code: Select all

Opened serial port COM9
Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 40572
Sending DFU start packet
Sending DFU init packet
Sending firmware file
########################################
########################################
Activating new firmware

Device programmed.
DFU upgrade took 6.638053894042969s
I have flashed the LED Blink code, and it works perfectly fine with the above procedure with nRF52840DK, but when I used the same pins P0.2(RST), P0.3(DC), P0.4(CS), P0.5(BUSY), P0.12(DIN) and P0.13(MOSI) with EPD driver code, there is no change in Paper display.

I have doubts about which pins to use as MISO and CLK, for SPI communication used in the EPD driver code. I have asked Nordic, they said any pin works fine for SPI except for a few. But in code there are no manually selection for MOSI and CLK pin. In Adafruit Bluefruit nRF52 datasheet its mentioned MOSI (P0.13) and SCK (P0.12), but as I mentioned above using those pins shows no change on Epaper display.

Here complete code :

Code: Select all

/***************************************************
  Adafruit invests time and resources in providing this open-source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <Adafruit_GFX.h>    // Core graphics library
#include "Adafruit_EPD.h"

#define EPD_CS      4
#define EPD_DC      3
#define SRAM_CS     -1
#define EPD_RESET   2 
#define EPD_BUSY    5 

Adafruit_SSD1680 display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

#include "gimage_img.h" //defined image data uint8_t gImage_IMG_0001[4000]

void setup(void) {
  Serial.begin(115200);
  Serial.print("Hello! EPD Test");

  display.begin();
  Serial.println("Initialized");
  display.setRotation(2);
}

void loop() {
 
  Serial.println("Displaying Image");
  display.clearBuffer();
  uint16_t x = 0;
  uint16_t y = 0;
  display.fillScreen(EPD_RED);
  display.drawBitmap(x, y, gImage_IMG_0001,  150 , 150, EPD_WHITE); //SET BIT WHITE && UN-SET BIT RED
  display.display(); 
  delay(20000);
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”