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!

+3
c embedded usb


source to share


No one has answered this question yet

Check out similar questions:

15
How can I detect the USB disconnect event? (Windows Application, .NET C #)
five
Change the interrupt handler startup priority level?
3
Cortex M0 + (SAMD21) does not execute pending interrupt
2
USB enumeration error in ColdFire MCF52259
1
Rational behavior in transmission code based on low latency interrupts
1
Linux USB device driver errors
1
After MCU NVIC_GenerateSystemReset () USB TX does not work
0
Is it safe to call send_sig_info () inside a URB completion routine?
0
Keil uVision4 Loading the wrong firmware
-1
How do I run a minimal project using STM32CubeMX?



All Articles
Loading...
X
Show
Funny
Dev
Pics