본문 바로가기
arduino

[Arduino] 메모리 주소 오류 : Usage fault is ..., Bus fault is ...

by developer_j 2025. 8. 8.
728x90
반응형

아두이노 mqtt 통신 테스트 중 발생한 오류.

Fault on interrupt or bare metal(no OS) environment
===== Thread stack information =====
  addr: 20007e58    data: 00000539
  addr: 20007e5c    data: 2000032c
  addr: 20007e60    data: 00004040

...

=================== Registers information ====================
  R0 : 007d2259  R1 : 00000539  R2 : 0000ea60  R3 : 00000000
  R12: 0ccccccc  LR : 00004b61  PC : 00000000  PSR: 60000000
==============================================================
Usage fault is caused by attempts to switch to an invalid state (e.g., ARM)
Show more call stack info by run: addr2line -e 
"C:\Users\USER\AppData\Local\arduino\sketches\F7D2BB71C7DD8AB0D18F4B0CFE693A36/sketch_aug5a.ino".elf 
-a -f 00000000 00004b60 0000434a 0000d30e 00004b82 00004188 0000f094 0000f0d2 00007ade 0000c09e 0000c094

Usage fault is ~~ 라고 뜨거나 

Bus fault is caused by precise data access violation
The bus fault occurred address is 52415453

이렇게 Bus fault is ~~ 라고 뜰 수도 있다.

 

어찌됐건 메모리 주소에 문제가 생겼다는 뜻이고, 나의 경우에는 publish 하려는 message 의 길이가 고정길이값보다 커서 생긴 경우였다. 

char publishMessage[50];
String message = "{\"msg.topic\" : " + String(sensorValue_1) + ... + "}";	// 대충 이미 50 바이트 넘어가는 String

...

message.toCharArray(publishMessage, message.length() + 1);

 

message 를 publishMessage 에 복사하려했는데, publishMessage 공간보다 message가 길어서 오류!

728x90
반응형