egoodii I understand how priorities in ARM cores work, but I'm trying to say that in the aforementioned example when I try to set priority 3 to a PORTB interrupt, Processor Expert pre-shifts the priority level up by 6 bits and generates C0.
Afterward, this number is passed to a macro NVIC_IP_PRI_31(0xC0), it gets upshifted again by 30 bits.
This produces 0x30 0000 0000 which is clearly incorrect.
The correct way would be to do NVIC_IP_PRI_31(0x03), which when upshifted would produce 0xC000 0000 which is a correct value (top 2 bits are set). I don't know why is PE doing this pre-shifting, but the resulting code is just invalid. It should leave the set value as-is and pass this to a Macro without doing the shifting.
Alternatively the shift value in the macro should be changed from 30 to 24.
I did a quick test and generated a PE project for KL02Z8, which is an identical ARM M0 core, and the value in the MKL02Z08.h file is:
#define NVIC_IP_PRI_31_SHIFT 24
So it's definitely only a problem with MKL05Z4.h file. I'll try to report this to PE guys somehow.