Skip to content

Commit 5c73b3e

Browse files
committed
add the FAQ about hardfault
1 parent 51c4928 commit 5c73b3e

File tree

4 files changed

+55
-8
lines changed

4 files changed

+55
-8
lines changed

bsp/nrf5x/README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,54 @@ nrf5x
132132

133133
下面提供一种擦写softdevice的方法。在keil中选择softdevice Erase的FLASH算法,这个时候就烧写之前可以擦除之前的softdevice。
134134

135-
![image-20201017194935643](docs/images/softdevice_erase.png)
135+
![image-20201017194935643](docs/images/softdevice_erase.png)
136+
137+
138+
139+
### 2.如果在使用softdevice的时候,连上手机时候出现一些hardfault
140+
141+
如下所示:
142+
143+
```
144+
psr: 0x8100000f
145+
r00: 0x00000000
146+
r01: 0x200034e6
147+
r02: 0x00000000
148+
r03: 0x200034dc
149+
r04: 0x200034dc
150+
r05: 0x00000000
151+
r06: 0x200034e6
152+
r07: 0xdeadbeef
153+
r08: 0xdeadbeef
154+
r09: 0xdeadbeef
155+
r10: 0xdeadbeef
156+
r11: 0xdeadbeef
157+
r12: 0x00000000
158+
lr: 0x000369af
159+
pc: 0x00036972
160+
hard fault on handler
161+
162+
```
163+
164+
这个hardfault发生在SOFTDEVICE内部,由于代码不开源,这边尝试了修改如下函数,可以不触发hardfault。
165+
166+
```
167+
rt_hw_interrupt_disable PROC
168+
EXPORT rt_hw_interrupt_disable
169+
;MRS r0, PRIMASK
170+
;CPSID I
171+
BX LR
172+
ENDP
173+
174+
;/*
175+
; * void rt_hw_interrupt_enable(rt_base_t level);
176+
; */
177+
rt_hw_interrupt_enable PROC
178+
EXPORT rt_hw_interrupt_enable
179+
;MSR PRIMASK, r0
180+
BX LR
181+
ENDP
182+
```
183+
184+
185+

bsp/nrf5x/nrf52840/board/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ menu "On-chip Peripheral Drivers"
314314
endif
315315
config BSP_USING_SPI
316316
bool "Enable SPI"
317-
select RT_USING_PIN
318-
default y
317+
select RT_USING_SPI
318+
default n
319319

320320
if BSP_USING_SPI
321321
config NRFX_SPI_ENABLED

bsp/nrf5x/nrf52840/board/board.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ void SysTick_Configuration(void)
5353
void rt_hw_board_init(void)
5454
{
5555
rt_hw_interrupt_enable(0);
56-
// sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
57-
/* Activate deep sleep mode */
58-
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
5956

6057
SysTick_Configuration();
6158

bsp/nrf5x/nrf52840/board/board.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ extern int __bss_end__;
2121
#define HEAP_BEGIN ((void *)&__bss_end__)
2222
#endif
2323

24-
#define HEAP_SIZE 16*1024
25-
#define HEAP_END (HEAP_BEGIN + HEAP_SIZE)
24+
25+
#define HEAP_END (MCU_SRAM_END_ADDRESS)
2626

2727
void rt_hw_board_init(void);
2828

0 commit comments

Comments
 (0)