Merge remote-tracking branch 'adafruit/master' into nrf_board_rename

This commit is contained in:
Dan Halbert 2018-08-23 16:25:57 -04:00
commit 4cc33f8de6
7 changed files with 31 additions and 18 deletions

1
.gitignore vendored
View File

@ -7,7 +7,6 @@
*.bin
*.map
*.hex
!ports/nrf/**/bootloader/**/*.hex
*.dis
*.exe

View File

@ -1,5 +1,5 @@
/*
GNU linker script for NRF52840 w/S140 6.0.0 SoftDevice
GNU linker script for NRF52840 w/S140 6.x.x SoftDevice
MEMORY MAP
------------------------------------------------------------------------
@ -17,7 +17,7 @@
0x00000000..0x00000FFF (4KB) Master Boot Record
*/
/* Specify the memory areas (S140 6.0.0) */
/* Specify the memory areas (S140 6.x.x) */
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000

View File

@ -2,7 +2,7 @@ MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SD ?= s140
SOFTDEV_VERSION ?= 6.0.0
SOFTDEV_VERSION ?= 6.1.0
BOOT_SETTING_ADDR = 0xFF000

View File

@ -2,7 +2,7 @@ MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SD ?= s140
SOFTDEV_VERSION ?= 6.0.0
SOFTDEV_VERSION ?= 6.1.0
BOOT_SETTING_ADDR = 0xFF000

View File

@ -35,18 +35,16 @@ function download_s132_nrf52_5_0_0
cd -
}
function download_s140_nrf52_6_0_0
function download_s140_nrf52_6_1_0
{
echo ""
echo "####################################"
echo "### Downloading s140_nrf52_6.0.0 ###"
echo "### Downloading s140_nrf52_6.1.0 ###"
echo "####################################"
echo ""
mkdir -p "${1}/s140_nrf52_6.0.0"
cd "${1}/s140_nrf52_6.0.0"
wget https://www.nordicsemi.com/eng/nordic/download_resource/60624/20/49271410/116072
mkdir -p "${1}/s140_nrf52_6.1.0"
cd "${1}/s140_nrf52_6.1.0"
wget https://www.nordicsemi.com/eng/nordic/download_resource/60624/25/88218841/116072
mv 116072 temp.zip
unzip -u temp.zip
rm temp.zip
@ -59,15 +57,15 @@ if [ $# -eq 0 ]; then
echo "No Bluetooth LE stack defined, downloading all."
download_s132_nrf52_2_0_1 "${SCRIPT_DIR}"
download_s132_nrf52_5_0_0 "${SCRIPT_DIR}"
download_s140_nrf52_6_0_0 "${SCRIPT_DIR}"
download_s140_nrf52_6_1_0 "${SCRIPT_DIR}"
else
case $1 in
"s132_nrf52_2_0_1" )
download_s132_nrf52_2_0_1 "${SCRIPT_DIR}" ;;
"s132_nrf52_5_0_0" )
download_s132_nrf52_5_0_0 "${SCRIPT_DIR}" ;;
"s140_nrf52_6_0_0" )
download_s140_nrf52_6_0_0 "${SCRIPT_DIR}" ;;
"s140_nrf52_6_1_0" )
download_s140_nrf52_6_1_0 "${SCRIPT_DIR}" ;;
esac
fi

View File

@ -58,7 +58,7 @@ void usb_init(void) {
sd_power_usbregstatus_get(&usb_reg);
}else
#else
#endif
{
// Power module init
const nrfx_power_config_t pwr_cfg = { 0 };
@ -72,7 +72,6 @@ void usb_init(void) {
usb_reg = NRF_POWER->USBREGSTATUS;
}
#endif
if ( usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk ) {
tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_DETECTED);
@ -82,6 +81,21 @@ void usb_init(void) {
tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
}
// create serial number based on device unique id
extern uint16_t usb_desc_str_serial[1 + 16];
char nibble_to_hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 8; j++) {
uint8_t nibble = (NRF_FICR->DEVICEID[i] >> j * 4) & 0xf;
// Invert order since it is LE, +1 for skipping descriptor header
uint8_t const idx = (15 - (i * 8 + j)) + 1;
usb_desc_str_serial[idx] = nibble_to_hex[nibble];
}
}
tusb_init();
#if MICROPY_KBD_EXCEPTION

View File

@ -78,6 +78,8 @@ enum {
// STRING DESCRIPTORS
//--------------------------------------------------------------------+
uint16_t usb_desc_str_serial[1+16] = { TUD_DESC_STR_HEADER(16) };
// array of pointer to string descriptors
uint16_t const * const string_desc_arr [] =
{
@ -91,7 +93,7 @@ uint16_t const * const string_desc_arr [] =
TUD_DESC_STRCONV('C','i','r','c','u','i','t','P','y',' ','n','R','F','5','2'),
// 3 Serials TODO use chip ID
TUD_DESC_STRCONV('1', '2', '3', '4', '5'),
usb_desc_str_serial,
// 4 CDC Interface
TUD_DESC_STRCONV('C','i','r','c','u','i','t','P','y',' ','S','e','r','i','a','l'),