-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
nrf: Add pca10059 with tinyusb adaptation. #5112
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
Conversation
a14e8e8
to
cda9077
Compare
Rebased and amended some documentation. I also realized that the SoftDevice enable hack i had to do to get SD working already was in the PR. So, the current code here should work for both with and without SD. |
|
||
#if BLUETOOTH_SD | ||
// Initialize the clock and BLE stack. | ||
ble_drv_stack_enable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mentioned hack to get USB events propagated in case of compilation with SD=s140.
ports/nrf/drivers/usb/usb_cdc.c
Outdated
static void cdc_task(void); | ||
|
||
uint8_t rx_ringbuf_array[4096]; | ||
uint8_t tx_ringbuf_array[4096]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put quite large buffers to handle good REPL paste feeling. This might be a bit too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stm32 uses 1024 bytes for each, so probably that would be plenty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amended change to use 1024, ringbuffer size. Also made this group of variables static. Removed unused rx_buf and tx_buf.
#define MICROPY_PY_MACHINE_TEMP (1) | ||
#define MICROPY_PY_RANDOM_HW_RNG (1) | ||
|
||
#define USB_CDC (1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any suggestion on better name for this define? I know it is a bit inconsistent, but i could not really settle on what to call it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On stm32 it would be MICROPY_HW_USB_CDC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I wonder how i slipped on that one. I tried to find it =) Changed the use of USB_CDC
to MICROPY_HW_USB_CDC
.
Thanks @glennrub, nice feature! I want to test this with a Particle Xenon board. |
cda9077
to
0edff82
Compare
Great @dpgeorge! I have also used pca10056 during development. It's a matter of setting the MICROPY_HW_USB_CDC (1), and it should spin on that board as well. |
On some Linux systems the Modem Manager (MM) kicks in. To prevent the MM from sending AT commands to the device at initialization, a udev rule has to be applied. My current
I'm not sure, should this be part of the source? Or is this kind of well known? |
It's kind of well known. At least the stm32 port has had USB CDC since the beginning and this has not been a big issue. Of course, we can document it if needed. |
It is sort of documented here: https://github.com/micropython/micropython/wiki/Board-STM32F407-Discovery#programming-from-linux-via-dfu |
I tested this PR with a Xenon (using #5158) and it didn't work. The PC could see that there was a new USB device attached but it could not enumerate it. I'm not sure what is wrong. @glennrub I don't want to let this failure hold up the PR. If it works for you on the PCA 56/59 boards then I'm happy to put this code in master. It'll need to be rebased and conflicts resolved (they are minor). Also, does it make sense to split this PR into two commits, one for adding PCA10059 and one for integrating TinyUSB? (It doesn't matter which order, maybe add TinyUSB first so PCA10059 can use it.) |
You might have been hit by the "SD enable" issue i try to workaround. Did you compile it with SD=s140?
Sure, will do! Good suggestion! I would also like to remove the text i added about "PogoProg" in the readme before we merge. The name of the tool is a bit false leading, as it is just a board with pins, not including the programmer itself. This might get confusing if people actually ordered the PogoProg and expected a programmer. I'll try to do the update today. |
No, I didn't use SD at all. Just compiled with |
0edff82
to
cef8037
Compare
Add nrf-port finyusb driver files. USB CDC can be activated by board configuration files using the MICROPY_HW_USB_CDC. Updating BLE driver, Makefile, nrfx-glue and main.c to plug in the tinyusb stack.
Add support for pca10059 with REPL over tinyusb USB CDC. The board also includes a board specific module that will recover UICR->REGOUT0 in case this has been erased. This initial support does not preserve any existing bootloader on the pca10090 in case this was present, and expects to use all available flash on the device.
cef8037
to
5d7fc9d
Compare
Thanks for splitting the commits, looks good! |
Add board.LED for Grand Central M4 Express
No description provided.