Skip to content
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

Enable UARTE1 for 52840 MCUs. #112

Merged
merged 1 commit into from
Sep 3, 2019
Merged

Enable UARTE1 for 52840 MCUs. #112

merged 1 commit into from
Sep 3, 2019

Conversation

bjc
Copy link
Contributor

@bjc bjc commented Aug 12, 2019

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

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
Copy link
Contributor Author

bjc commented Aug 14, 2019

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
Copy link
Contributor

korken89 commented Sep 3, 2019

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