So far there is no board in the ports. I successfully built micropython for the pca10056 (since the Adafruit Feather nrf52480 is based on this one)
Code: Select all
make BOARD=pca10056 SD=s140 sd
Code: Select all
make BOARD=pca10056 SD=s140 sd
Great, how did you fix it?ltmerlin wrote: ↑Wed Feb 19, 2020 10:56 amI have managed to built and flash the Adafruit nrf52480 with micropython instead of circuitpython. (Used the https://github.com/Microsoft/uf2/blob/m ... uf2conv.py to created the uf2 after using the regular makefile )
Yes, what you said is correct for the time being. The nrf port has ubluepy and the stm32 and nrf ports have ubluetooth. My plan is to update the NRF port to use ubluetooth also, so I guess the current state of ubluepy is "deprecated". The APIs are quite different -- the idea is that ubluetooth is as low-level as possible, you can build higher-level object-based abstractions on top of it in Python.
Inside your Micropython git clone directory create a new board directory for the custom port named NRF52840:Great, how did you fix it?
Code: Select all
cd /micropython/ports/nrf/boards
mkdir NRF52840
Code: Select all
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Glenn Ruben Bakke
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define MICROPY_HW_BOARD_NAME "FEATHER-NRF52840"
#define MICROPY_HW_MCU_NAME "NRF52840"
#define MICROPY_PY_SYS_PLATFORM "nrf52840-feather"
#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_HW_USB_CDC (1) //very important to get USB-Serial to work
#define MICROPY_HW_ENABLE_RNG (1)
#define MICROPY_HW_NEOPIXEL (16)
#define BOARD_HAS_CRYSTAL 1
#if QSPI_FLASH_FILESYSTEM
#define MICROPY_QSPI_DATA0 (17)
#define MICROPY_QSPI_DATA1 (22)
#define MICROPY_QSPI_DATA2 (23)
#define MICROPY_QSPI_DATA3 (21)
#define MICROPY_QSPI_SCK (19)
#define MICROPY_QSPI_CS (20)
#endif
#define MICROPY_HW_HAS_LED (1)
#define MICROPY_HW_LED_COUNT (2)
#define MICROPY_HW_LED_PULLUP (0)
#define MICROPY_HW_LED1 (32+10) // LED1
#define MICROPY_HW_LED2 (32+15) // LED2
// UART config
#define MICROPY_HW_UART1_RX (24)
#define MICROPY_HW_UART1_TX (25)
//#define MICROPY_HW_UART1_CTS (7)
//#define MICROPY_HW_UART1_RTS (5)
#define MICROPY_HW_UART1_HWFC (0)
// SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (14)
#define MICROPY_HW_SPI0_MOSI (13)
#define MICROPY_HW_SPI0_MISO (15)
#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"
Code: Select all
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION = 6.1.1
LD_FILES += boards/nrf52840_1M_256k.ld
NRF_DEFINES += -DNRF52840_XXAA
Code: Select all
P0,P0
P1,P1
P2,P2
P3,P3
P4,P4
P5,P5
P6,P6
P7,P7
P8,P8
P9,P9
P10,P10
P11,P11
P12,P12
P13,P13
P14,P14
P15,P15
P16,P16
P17,P17
P18,P18
P19,P19
P20,P20
P21,P21
P22,P22
P23,P23
P24,P24
P25,P25
P26,P26
P27,P27
P28,P28
P29,P29
P30,P30
P31,P31
P32,P32
P33,P33
P34,P34
P35,P35
P36,P36
P37,P37
P38,P38
P39,P39
P40,P40
P41,P41
P42,P42
P43,P43
P44,P44
P45,P45
P46,P46
P47,P47
Code: Select all
cd /micropython/ports/nrf/
make submodules
make BOARD=NRF52840 sd=s140
Code: Select all
cd /micropython/ports/nrf/build-NRF52840-s140
python3 /Users/ltmerlin/Desktop/uf2tool.py firmware.hex -c -f 0xADA52840
Code: Select all
## Create binary .hex file from the .out file
Code: Select all
### Create a .uf2 file from the .hex file
uf2: $(BUILD)/$(OUTPUT_FILENAME).uf2
$(BUILD)/$(OUTPUT_FILENAME).uf2: $(BUILD)/$(OUTPUT_FILENAME).hex
$(ECHO) "Create $@"
$(PYTHON3) $(TOP)/tools/uf2conv.py -f 0xADA52840 -c -o "$(BUILD)/$(OUTPUT_FILENAME).uf2" $^
Code: Select all
all: binary uf2
Code: Select all
cd micropython
make -C mpy-cross
cd ports/nrf
./drivers/bluetooth/download_ble_stack.sh
make submodules
make BOARD=feather_sense SD=s140
cd build-feather_sense-s140
python3 ../../../tools/uf2conv.py firmware.hex -c -f 0xADA52840
Code: Select all
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application firmware.hex firmware.zip
adafruit-nrfutil dfu serial --package firmware.zip -p /dev/usbmodem1101 -b 115200