nRF52840 - HolyIot Board Definition

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

nRF52840 - HolyIot Board Definition

Post by devnull » Fri Oct 26, 2018 1:17 pm

I am trying to create a board definition for the HolyIot board (Holyiot_18010), but are unsure what the following is for:

Code: Select all

#define MICROPY_HW_UART1_HWFC       (1)
Does anybody know ?

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: nRF52840 - HolyIot Board Definition

Post by devnull » Fri Oct 26, 2018 1:20 pm

Also, if I comment out flow control, will that disable flow control ??

Code: Select all

// #define MICROPY_HW_UART1_CTS     (7)
// #define MICROPY_HW_UART1_RTS     (5)

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: nRF52840 - HolyIot Board Definition

Post by devnull » Fri Oct 26, 2018 1:24 pm

OK, I am guessing that MICROPY_HW_UART1_HWFC is Hardware Flow Control, and that setting it to 0 will disable flow control ?!

User avatar
WhiteHare
Posts: 129
Joined: Thu Oct 04, 2018 4:00 am

Re: nRF52840 - HolyIot Board Definition

Post by WhiteHare » Fri Oct 26, 2018 1:38 pm

Good question. I'm guessing the answer is yes, because the default for the hardware is no flow control (see 6.33.10.13 CONFIG in the Nordic nRF52840 datasheet). So, if you defeat whatever micropython code enables it, it should default to no flow control on the uart.

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: nRF52840 - HolyIot Board Definition

Post by devnull » Fri Oct 26, 2018 1:48 pm

Well this is the definition I have created, but not yet tested.

I am assuming the port numbers are contiguous starting with Port 0 (32 bits) followed by Port 1 (16 bits).

It uses the outer top 3/4 pins on the left and right hand side for SPIO and UART1, no Flow Control and no LEDs.

Code: Select all

/*
  @@ PORT 0 @@
  0   = P0.0
  09  = P0.09 << RX
  10  = P0.10 << TX
  31  = P0.31
  
  @@ PORT 1 @@
  32  = P1.00
  33  = P1.01 
  34  = P1.02 

  42  = P1.10 << SCLK
  43  = P1.11 << MOSI
  44  = P1.12  
  45  = P1.13 << MISO
  46  = P1.14
  47  = P1.15

*/

#define MICROPY_HW_BOARD_NAME       "holyiot_18010"
#define MICROPY_HW_MCU_NAME         "NRF52840"
#define MICROPY_PY_SYS_PLATFORM     "nrf52840-PDK"

#define MICROPY_PY_MACHINE_UART     (1)
#define MICROPY_PY_MACHINE_HW_PWM   (1)
#define MICROPY_PY_MACHINE_HW_SPI   (1)
#define MICROPY_PY_MACHINE_TIMER    (1)
#define MICROPY_PY_MACHINE_RTCOUNTER (1)
#define MICROPY_PY_MACHINE_I2C      (1)
#define MICROPY_PY_MACHINE_ADC      (1)
#define MICROPY_PY_MACHINE_TEMP     (1)
#define MICROPY_PY_RANDOM_HW_RNG    (1)

// LEDS - NOT USED
#define MICROPY_HW_HAS_LED          (0)
#define MICROPY_HW_LED_COUNT        (0)
#define MICROPY_HW_LED_PULLUP       (0)

// #define MICROPY_HW_LED1          (13) // LED1
// #define MICROPY_HW_LED2          (14) // LED2
// #define MICROPY_HW_LED3          (15) // LED3
// #define MICROPY_HW_LED4          (16) // LED4

// UART config
#define MICROPY_HW_UART1_RX         (9)   // P0.09
#define MICROPY_HW_UART1_TX         (10)  // P0.10

// UART FLOW CONTROL
#define MICROPY_HW_UART1_HWFC       (0)   // Hardware Flow Control
// #define MICROPY_HW_UART1_CTS     (7)
// #define MICROPY_HW_UART1_RTS     (5)

// SPI0 config
#define MICROPY_HW_SPI0_NAME        "SPI0"

#define MICROPY_HW_SPI0_SCK         (42)  // P1.10
#define MICROPY_HW_SPI0_MOSI        (43)  // P1.11
#define MICROPY_HW_SPI0_MISO        (45)  // P1.13

#define MICROPY_HW_PWM0_NAME        "PWM0"
#define MICROPY_HW_PWM1_NAME        "PWM1"
#define MICROPY_HW_PWM2_NAME        "PWM2"
#if 0
#define MICROPY_HW_PWM3_NAME        "PWM3"
#endif

//#define HELP_TEXT_BOARD_LED         "1,2,3,4"

User avatar
WhiteHare
Posts: 129
Joined: Thu Oct 04, 2018 4:00 am

Re: nRF52840 - HolyIot Board Definition

Post by WhiteHare » Fri Oct 26, 2018 2:04 pm

I haven't looked into what micropython's pin naming convention is, so I'm curious what you find out. I can say for sure though that it can vary from one platform to another (e.g. mbed's pin naming convention is different than what the Segger Embedded IDE does).

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: nRF52840 - HolyIot Board Definition

Post by devnull » Sat Oct 27, 2018 6:13 am

Setting:

Code: Select all

#define MICROPY_HW_UART1_HWFC       (0)
Does disable Flow Control.

But simply changing from :

TX: 6 > 10
RX: 8 > 9

Does not work, it appears that 9 & 10 are used for the NFC antannae, switching to 22(0.22) and 32(1.0) works.

Also, 18 is assigned to /reset.

User avatar
WhiteHare
Posts: 129
Joined: Thu Oct 04, 2018 4:00 am

Re: nRF52840 - HolyIot Board Definition

Post by WhiteHare » Sat Oct 27, 2018 12:54 pm

Nice work.

Yeah, 9 and 10 can be made to work by disabling NFC on them, but they are slightly crippled (relative to other pins) even if you do, so I think you're right: it's best to avoid them if you can.

User avatar
WhiteHare
Posts: 129
Joined: Thu Oct 04, 2018 4:00 am

Re: nRF52840 - HolyIot Board Definition

Post by WhiteHare » Sat Oct 27, 2018 1:13 pm

BTW, if you haven't already, you may want to look into Nordic's nRF52840-DONGLE. At $10, it's only slightly more than your HolyIOT. Also, it passed FCC (which I don't know if that matters, since you are in Singapore). On the other hand, the HolyIOT has more pins exposed, so there is that in its favor.

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: nRF52840 - HolyIot Board Definition

Post by devnull » Sat Oct 27, 2018 2:14 pm

Funny you should mention that, last Friday I ordered 2 of them from Farnell, that was before I made progress with the holyiot

:-)

Post Reply