Skip to content

Enable UARTE1 for 52840 MCUs.#112

Merged
Yatekii merged 1 commit into
nrf-rs:masterfrom
bjc:52840-uarte1
Sep 3, 2019
Merged

Enable UARTE1 for 52840 MCUs.#112
Yatekii merged 1 commit into
nrf-rs:masterfrom
bjc:52840-uarte1

Conversation

@bjc

@bjc bjc commented Aug 12, 2019

Copy link
Copy Markdown
Contributor

This is mentioned in the datasheet in §4.2 Table 3 (Instantiation
Table) and exists in the PAC for this chipset.

Tested with a nrf52840-mdk board.

This is mentioned in the datasheet in §4.2 Table 3 (Instantiation
Table). And exists in the PAC for this chipset.

Tested with a nrf52840-mdk board.
@jacobrosenthal

Copy link
Copy Markdown

Checks out on an nrf52840 dk. (and works with #102 with a fix hopefully @korken89 saw https://github.com/korken89/nrf52-hal/pull/1)

One annoying note I hadn't seen before, unlike UARTE0, both the interrupt and the handler are named UARTE1

so with UARTE0 it looks like this

use hal::target::{interrupt, TIMER0 as TIM0, UARTE1 as UARTE0};

    #[interrupt(priority = 2, resources = [RX, TX], spawn = [printer, rx_error])]
    fn UARTE0_UART0() {
    }

but on UARTE1 you have to import UARTE1 as something else

use hal::target::{interrupt, TIMER0 as TIM0, UARTE1 as UARTE1_OTHER};

    #[interrupt(priority = 2, resources = [RX, TX], spawn = [printer, rx_error])]
    fn UARTE1() {
    }

@bjc

bjc commented Aug 14, 2019

Copy link
Copy Markdown
Contributor Author

In general, the peripherals and their interrupts share names. The exceptions are the peripherals which share instances (e.g., UART0/UARTE0 share an instance, and the peripherals are named differently, but the interrupt handler is named UARTE0_UART0).

UARTE1 doesn't share any instances with anything else (there is no UART1), so, like most other things, the peripheral and the interrupt have the same name.

I don't use rtfm, so I don't run into this issue. I also only import the $pac::Interrupt enum, so it doesn't conflict with the peripheral name itself (e.g., I refer to the peripheral type as UARTE0, the interrupt as Interrupt::UARTE0_UART0 and the isr is fn UARTE0_UART0() {}).

@korken89

korken89 commented Sep 3, 2019

Copy link
Copy Markdown
Contributor

Hi, is there something blocking this PR?

@Yatekii Yatekii merged commit 56ea2dd into nrf-rs:master Sep 3, 2019
@bjc bjc deleted the 52840-uarte1 branch September 8, 2019 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants