Bus Fault

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,730件の閲覧回数
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 解決策
1,411件の閲覧回数
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 返信
1,412件の閲覧回数
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 件の賞賛
返信