USB interrupt masks not loading STM32L151CC
I am currently facing a strange problem with the STM USB libraries. I can successfully upload the firmware to the STM32L152D-EVAL board (which uses the STM32L152ZD), however I cannot change the same code to work on my form factor board which uses the aforementioned STM32L151CC.
After executing the code with the debugger (ULINK2, using KEIL uVision4 IDE), I noticed that the code would crash when setting the interrupt mask in the function USB_SIL_Init()
uint32_t USB_SIL_Init(void)
{
/* USB interrupts initialization */
/* clear pending interrupts */
_SetISTR(0);
wInterrupt_Mask = IMR_MSK;
/* set interrupts mask */
_SetCNTR(wInterrupt_Mask);
return 0;
}
More specifically, _SetCNTR(wInterrupt_Mask);
this is what is giving me the error. I have not changed the value IMR_MSK
between any board. This value is given as
#define IMR_MSK (CNTR_CTRM | CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM \
| CNTR_ESOFM | CNTR_RESETM )
which is 0xBF00
_SetCNTR
is defined as follows:
#define _SetCNTR(wRegValue) (*CNTR = (uint16_t)wRegValue)
C is CNTR
defined as
/* Control register */
#define CNTR ((__IO unsigned *)(RegBase + 0x40))
And RegBase
there is
#define RegBase (0x40005C00L) /* USB_IP Peripheral Registers base address */
I am currently going through the STM documentation on this subject, but I can't seem to find anything specific regarding the default states for two different chips. I am assuming it has something to do with the base address, however the Datasheet shows that this is the correct address.
Can anyone help me with this?
Thank!
source to share
No one has answered this question yet
Check out similar questions: