-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nrf52840 dongle (PCA10059) support #200
Comments
current code assume nrf52840 always come with an external flash (true for feather 52840 and DK). You need to remap that to internal flash. It is complicated, maybe you can disable the USB MSC class in the tusb_config.h and move on with others first. When I got more time, I could do that remap part later. |
@hathach Is the USB MSC comment for the usb_init issue or the P0.12/P1.09 issue? I assume it's for the USB issue; with would make sense for all the windows trouble I had. I can leave the usb_init out for now and focus on getting the GPIOs tested and working... |
Update: I tested all the GPIOs and pulled out my oscilloscope to validate that everything checks out. After converting the NFC pins to GPIOs, only Pin P1.00 cannot be toggled using digitalToggle(32). All other GPIOs accessible on the dongle can be toggled. All I can measure at P1.00 is a constant digital high (1.8V). Pressing reset momentarily toggles it to 0V. |
@jpconstantineau usb_init() will init the whole usb stack, you still need it for Serial/CDC and uploading (without jlink). You could simply turn usb msc off (leaving cdc on) by change this config For the voltage issue, you may find this useful, I think Dan did an amazing job to address this. |
@hathach That did it! Thanks! Dropped the suggested code from https://devzone.nordicsemi.com/f/nordic-q-a/28562/nrf52840-regulator-configuration into a form similar to the code to switch from nfc to gpio and that worked. I am wondering where would be the best place to drop that code in. Would variantInit be a good choice? I suspect the bootloader would make more sense... P1.00 still stays at logic high even if I toggle the pin every 100ms |
Glad that works for you. You can put it into variant init for now ( with comment if possible ). I will double check and move it later to bootloader if needed. Or you can also fork our bootloader repo https://github.com/adafruit/Adafruit_nRF52_Bootloader and submit your PR as well. Either way, when I got more time to work/verify with the dongle, I will try my best to move it into correct place. |
According to the Pin assignments in the specs, P1.00 Maps to General purpose I/O, Trace buffer TRACEDATA[0] and Serial wire output (SWO) with recommended usage of QSPI. I suspect that P1.00 being "locked" might have to do with this. Do you know if QSPI in the nrf52840 feather express is tied to that line? |
What is the current status of this branch? |
I am having trouble getting the BLE UART example working on the dongle. Minimal example#include <bluefruit.h>
void setup()
{
// Logic analyzer debug output (1.13)
pinMode(45, OUTPUT);
digitalWrite(45, LOW);
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Bluefruit52 BLEUART Example");
Serial.println("---------------------------\n");
Bluefruit.begin();
Serial.println("Bluefruit initialized.");
}
void loop() {
delay(1000);
} My setup
DebugingSerial output of the example code, including my debug prints
fal_erase from flash_nrf5x.c, with debug outputbool fal_erase (uint32_t addr)
{
digitalWrite(45, HIGH);
delayMicroseconds(1000);
digitalWrite(45, LOW);
// Init semaphore for first call
if ( _sem == NULL )
{
_sem = xSemaphoreCreateCounting(10, 0);
VERIFY(_sem);
}
// retry if busy
uint32_t err;
while ( NRF_ERROR_BUSY == (err = sd_flash_page_erase(addr / FLASH_NRF52_PAGE_SIZE)) )
{
digitalToggle(45);
delay(1);
}
digitalWrite(45, HIGH);
delayMicroseconds(100);
digitalWrite(45, LOW);
VERIFY_STATUS(err, false);
digitalWrite(45, HIGH);
delayMicroseconds(100);
digitalWrite(45, LOW);
// wait for async event if SD is enabled
uint8_t sd_en = 0;
(void) sd_softdevice_is_enabled(&sd_en);
digitalWrite(45, HIGH);
delayMicroseconds(100); // The reset seems to happen about halfway thru this delay
digitalWrite(45, LOW);
if ( sd_en ) xSemaphoreTake(_sem, portMAX_DELAY);
digitalWrite(45, HIGH);
delayMicroseconds(1000);
digitalWrite(45, LOW);
return true;
} Logic analyzer5x As this is (consistently) happening in the middle of a delay (something parallel to the current code is causing the reset), I'm at a loss of how to continue debugging the issue. Could it be due to me using the default bootloader? @jpconstantineau could you verify wether the minimal example provided above results in a reset (and loss of the Serial link), or if it is likely to be something wrong on my end? |
hi, just want to say, we remove the pca10056 bootloader binary since we are doing release and this board port is not done yet. The bootloader binary for that board can be found here https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases |
@jpconstantineau Could you be able to resolve all the issues with pca100569. This board is not commonly used official by Adafruit engineer, therefore we have limited support, should issue with this board arise. It would be great if you can help us along the line. |
@hathach I have been busy completing some of the work I had committed to last year. Once my nrf52832 firmware is in a good spot, I'll move back on to the 840. Has the bootloader been updated for it? |
@jpconstantineau no problem, I can actually help testing the dongle for the PR, though, you need to help us in the long-term, should issue arises specifically with this board since it is not our "official" board, and other tech may not have this in his/her hand. If yes, please response to Limor in your PR. |
Dear @jpconstantineau , Can you please help me on how to flash the bootloader and how upload UF2 files to the dongle ? |
You will need a jlink or another dk board. |
I have a DK board, do you have any link to read the exact procedure ? |
@TasosR83 we have some docs here https://learn.adafruit.com/circuitpython-on-the-nrf52 but overall do not provide support for using nordic DK boards (we don't sell or use them!) |
my 840 Dongle doesn't appear as COM Port after flashing Adafruits Bootloader Hex files i tried different files...but the is not recognized as a COM Port.... |
i think there was a Problem with the DapLink Programmer |
For what it is worth, I was able to flash the UF2 bootloader onto my PCA10059 using a Black Magic Probe, with the following sequence: Use Black Magic Probe, and SWDP mode, 4 wires only plugged into a breadboard. Use the breadboard holes and male DuPont connectors to hold the dongle in place, Then, in gdb:
Then unplug from BMP, plug in to USB, should see the bootloader in dmesg, creating an NRF52BOOT Mass Storage Class volume, which can be used to load UF2-formatted files. P.S. It would be awesome if someone could create a firmware flashable via NRFConnect Desktop that contained a copy of the UF2 bootloader, and simply overwrote the Nordic bootloader, then rebooted after verifying that it was successfully written. |
I remember reading nordic bootloader is secured, you could upload application with open mode. But to upgrade bootloader it need to be signed. It also use ACL to prevent writing to bootloader in application mode as well. jlink is much easier. |
Interesting! I would have expected the application running on the processor to have full control over the flash, at least in terms of writing to it. I was unaware that it may be possible to prevent the application from writing to certain zones in this manner! |
closed due to lack of active development |
@hathach it looks like this task abandoned but support for PCA10059 still missing in master. Does it make sense to make pull request that adds PCA10059 board or there is no interest in supporting this board because it requires initial flashing with external debugger? It looks like PCA10059 is fully functional just need 3V mode to be useful i.e. LED flashing, etc. |
There is no interest to support pca10059, we are currently only focusing on support boards that our team have access to. |
It is sad but I see your point. The only reason I started making pca10059 board is that there is no Adafruit BLE boards that performs comparable to pca10059 in low power. With Feather Sense that does nothing the lowest power consumption that I able to achieve is about 500uA. At the same time with Dongle that reads sensor and advertises I can go down to about 30uA. I wish I had Adafruit board with LiPo connector and potentially charger and comparable low power performance. I would be happy to upstream both but... :(
|
we understand, it is just too difficult for us to become the support manager for a board we dont own, didn't design. it will disappoint people who have support questions and we don't want to do that. please continue to use your fork :) |
Leaving this Twitter thread here, which gives some guidance on issues which I had to overcome, in order to work with pca10059: |
Here are required code changes, to allow compilation for pca10059 (Community_nRF52_Arduino) with armeabi toolchain on KALI-Linux (debian):
|
thanks, feel free to submit a PR for the core changes (we still cant support the board definition but at least this will make it easier!) |
Thanks @ladyada for the comment. @mame82 I am planning to deprecate my "community" BSP and move over to a new tracking Community repo here: https://github.com/nRF52-Arduino/nRF52_Arduino You can give a try to the new repo and see if the same changes that you identified applies. If I remember well, I think many of the boards the original community BSP has are already there but with the advantage that any changes to the original Adafruit BSP will make its way to the new community much more easily - akin to micropython and circuitpython. |
yay thanks @jpconstantineau :) |
I started with getting the variant file ported over to the Nordic NRF52840 dongle (PCA10059)
I was able to flash the PCA10059 bootloader that's in the dev branch (thanks for that).
I was able to use the UF2 files and upload them to the Dongle.
Issues found:
The text was updated successfully, but these errors were encountered: