2014-01-21 01:43 PM
Hi all,
I''ve spent three strange nights of trying to find solution for the following issue.
No success yet.I'll be very glad for any advice how to solve it.
I've designed a board with STM32L152CBT6 (48pins)
Low power MCU 128kb Flash, 16kb RAM
Running on 32Mhz HSI
gcc 4.7.2 CodeSourcery, C/C++ with stdlib.
Stack size 0x400
The board contains just the MCU, SWD pins for Segger JLink connection for debugging and CC11001 RF 868Mhz module from Alibaba attached via 2mm spacing header and LED.
The power source is 1A DCDC converter TracoPower 3,3V.
The MCU has proper blocking capacitors 100nf (+1uF for VDDA).
The MCU uses SPI2 (PB12 CS, PB13 CLK, PB14 MISO, PB15 MOSI) and PB5 for IRQ handler EXTI_Line5.
I'm running my RF packet library for the Radio as a test case.
At first I need to mention that the same library/test I'm running without any issue on STMF4 Discovery Kit, self-designed board with STM32F103VC and as well on STM32L152 Discovery board.The last STM32L152RBT6 MCU is almost the same MCU with the same memory configuration, just with 64 pins.
So what is the issue:
The issue is Hard Faults during execution. The Hard Fault occurrence is irregular but typically it happens when a packet is sent via RF. Sometimes this is the first packet sometimes it is running stable but when i touch a board the Hard fault occurres. The packet send consumes up to 30mA current.
After three days of testing I have found a workaround how deal with.
It is enough just to put this code during board initialization
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
GPIO_Init(GPIOB, &GPIO_InitStructure);
The code only initializes the pin PB6 as output on already running GPIOB clock.
That's enough. No setting on/off the pin is needed and the board immediately running perfectly stable like on other boards I've mentioned before.
The PB6 is connected via SMD LED a resistor 750R to ground.
The voltage on the pin is at about 5mV.
When I've tried to remove the LED from board the Hard Fault returned back immediately.
I've tried to build another copy of the board to eliminate the MCU problem, the PCB problem, soldering problem etc.
And the result? The second board has the same strange problem.
Thank you very much for your advice
Regards
Jakub
#stm-forum-software-pisses-me-off #stm32-hard-fault2014-02-07 12:22 PM
2014-02-07 12:26 PM
After the PCB redesign (see above), the problem is GONE.
Many thanks for advice.jdx