Bus Fault

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Bus Fault

跳至解决方案
998 次查看
PeterFromSweden
Contributor III

This simple program causes a bus fault?!?

int main(void){  uint32_t tmp;  tmp = PORTD_PCR14; // <-- Causes HardFault or BusFault?!?                     // SCB_HFSR = 0x40000000                     // SCB_CFSR = 0x8200   return 0;}

 TWR-K60, Baremetal project.

 

Any Ideas what happened?

0 项奖励
1 解答
679 次查看
Dekiru
Contributor IV

You have to enable clock to modules before you access them, otherwise fault will happen.

 

Example:

/* Enable clock gate to used ports */
 SIM_SCGC5 |= SIM_SCGC5_PORTE_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK;

在原帖中查看解决方案

0 项奖励
1 回复
680 次查看
Dekiru
Contributor IV

You have to enable clock to modules before you access them, otherwise fault will happen.

 

Example:

/* Enable clock gate to used ports */
 SIM_SCGC5 |= SIM_SCGC5_PORTE_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK;

0 项奖励