0

NVIC_SetPriority documentation
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

NVIC_SetPriority documentation

by artelse on Tue May 14, 2019 12:04 pm

Am looking for info on setting the NVIC_SetPriority levels on a Trinket M0. Have checked https://github.com/adafruit/ArduinoCore-samd, but cannot finding any reference.

artelse
 
Posts: 7
Joined: Mon Jun 10, 2013 5:50 pm

Re: NVIC_SetPriority documentation

by adafruit_support_mike on Wed May 15, 2019 1:18 am

Yeah, the ARM documentation is pretty heavily fragmented.. datasheets for specific microcontrollers don't actually have documentation for the core, and ARM splits its own documentation into "User manual", "Hardware manual", and "Technical manual" sections, all of which refer to the others heavily, but just assume you know where to find the specific document they mean.

The NVIC is covered in the CMSIS-CORE (Cortex Microcontroller Software Interface Standard, core modules):

https://arm-software.github.io/CMSIS_5/ ... C__gr.html

Bookmark it, because finding it through any rational web search (or, heaven help you, ARM's own website), is a lot like using a phone menu that doesn't have an item for what you really want.

adafruit_support_mike
 
Posts: 59156
Joined: Thu Feb 11, 2010 2:51 pm

Re: NVIC_SetPriority documentation

by artelse on Wed May 15, 2019 11:13 am

Thanks for that hard to find info!
The problem I am having is that when I set and enable this interrupt, the serial port fails.
Code: Select all | TOGGLE FULL SIZE
NVIC_SetPriority(TCC2_IRQn, 0x03);
NVIC_EnableIRQ(TCC2_IRQn);

So I hoped that lowering the interrupt level would resolve it, but no..
Any hints what could cause the loss of the serial port?

artelse
 
Posts: 7
Joined: Mon Jun 10, 2013 5:50 pm

Re: NVIC_SetPriority documentation

by adafruit_support_mike on Wed May 15, 2019 11:31 pm

What interrupt are you using? You might have a collision with an interrupt that can be mapped to the SERCOM's RX pin.

adafruit_support_mike
 
Posts: 59156
Joined: Thu Feb 11, 2010 2:51 pm

Re: NVIC_SetPriority documentation

by artelse on Thu May 16, 2019 7:25 am

Issue resolved the code ran fine on a fresh Trinket M0. In the interrupt I read ADC, but had damaged the input with an improper voltage divider crashing the cpu.

artelse
 
Posts: 7
Joined: Mon Jun 10, 2013 5:50 pm

Re: NVIC_SetPriority documentation

by adafruit_support_mike on Thu May 16, 2019 11:44 pm

Glad to hear you found the problem and got things working. Happy hacking!

adafruit_support_mike
 
Posts: 59156
Joined: Thu Feb 11, 2010 2:51 pm

Re: NVIC_SetPriority documentation

by artelse on Fri May 17, 2019 7:30 pm

Actually transplanting the cpu to my own board, the problem returned. It turned out the be a power issue. The stepup converter I am controlling with the SAMD21 appeared to have an inrush current far higher than I anticipated.. one of those gotcha's that only reveals itself by capturing on the scope.
Anyway, can you tell me where to find header files or documentation of the register definitions and such of the SAMD21 chip? Thanks!

artelse
 
Posts: 7
Joined: Mon Jun 10, 2013 5:50 pm

Re: NVIC_SetPriority documentation

by westfw on Fri May 17, 2019 10:22 pm

.../packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/samd21/include/component/* "mostly"
One file for each peripheral. There's a standard format - some hints are here: https://github.com/WestfW/SAMD10-experiments

OTOH, since you were asking about NVIC_SetPriority(), you might be looking for the ARM "Core" definitions rather than the Atmel Peripheral definitions, and they'll be somewhere like: .../packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include
westfw
 
Posts: 1568
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: NVIC_SetPriority documentation

by artelse on Sat May 18, 2019 10:27 am

Thanks, was looking in the wrong directory.

artelse
 
Posts: 7
Joined: Mon Jun 10, 2013 5:50 pm

Please be positive and constructive with your questions and comments.