AnsweredAssumed Answered

stm32L476 buggy package

Question asked by franzi.edo on Apr 15, 2017
Latest reply on Apr 18, 2017 by waclawek.jan

Dear all,

During a porting of an RTOS on a Discovery 476 board I discovered a serious problem with the stm32l476xx.h file provided by ST. All the elements of timers structure are defined as a 32-bits. So, after having spent a couple of hours in debugging my porting I discovered that some elements HAVE to be accessed in a 16-bits and not in a 32-bits. In particular, the SR register accessed in 32-bits crashe my system with an "Hard Fault Exception". In the documentation the SR register is described to be 16-bits. So, I modified the original structure of the package and now everything work as expected. Here is my modification.

 

The original package (that crash the interruption acknowledge)

 

typedef struct {
   ...

   volatile uint32_t SR;
   ...

} TIM_TypeDef;

 

The modified package (that works)

 

typedef struct {
   ...

   volatile uint16_t SR;
   volatile uint16_t RESERVED0;
   ...

} TIM_TypeDef;

 

I pointed different peripheral structures and I discovered that potentially I can have the same problem (of course, this depends on how the silicon supports the 32-bit accesses for 16-bit wide registers).

Now I have serious doubts regarding the quality of the packages provided by ST!

 

Regards

   Edo

Outcomes