Hard Fault of Pixhawk while starting

#1

Hi,
Recently when I connect my pixhawk to my laptop with usb, it shuts down 2-3 times before starting normally.This started happening after I made some changes to mc_att_control module to fit my requirement.I am using Pixhawk 1 board and flashed px4fmuv2-default after making changes to mc_att_control module.The fault log file is shown below. Can anyone help me figure out the problem?

[hardfault_log] – 2000-01-01-00:00:03 Begin Fault Log –
System fault Occurred on: 2000-01-01-00:00:03
Type:Hard Fault in file:armv7-m/up_hardfault.c at line: 171 running task: mc_att_control
FW git-hash: f95f4c5f0969d478566790fdd783c5e33f21646f
Build datetime: Jul 13 2018 15:57:36
Build url: localhost
Processor registers: from 0x2001b1f4
r0:0x452292ed r1:0x452292ed r2:0x2001a410 r3:0x080d9210 r4:0x2001a0d0 r5:0x00000001 r6:0x2001a410 r7:0x00000000
r8:0x0033e09a r9:0x00000000 r10:0x00000000 r11:0x2001a4f8 r12:0x0800c105 sp:0x2001b2c8 lr:0x0807ee1b pc:0x0800b912
xpsr:0x21000000 basepri:0x000000f0 control:0x00000004
exe return:0xffffffe9
IRQ stack:
top: 0x200029f0
sp: 0x200029a0 Valid
bottom: 0x20002704
size: 0x000002ec
used: 000000c8
User stack:
top: 0x2001b398
sp: 0x2001b2c8 Valid
bottom: 0x2001ad0c
size: 0x0000068c
used: 0000068c
Interrupt sp memory region, stack pointer lies within stack
0x20002a51 0x00000000
0x20002a50 0x00000000
0x20002a4f 0x00000000
0x20002a4e 0x00000000
0x20002a4d 0x00000000
0x20002a4c 0x00000000
0x20002a4b 0x00000000
0x20002a4a 0x00000000
0x20002a49 0x00000000
0x20002a48 0x00000000
0x20002a47 0x00000000
0x20002a46 0x00000000
0x20002a45 0x00000000
0x20002a44 0x00000000
0x20002a43 0xffffffe9
0x20002a42 0x00000000
0x20002a41 0x00000000
0x20002a40 0x00000000
0x20002a3f 0x20002cd8
0x20002a3e 0x00000000
0x20002a3d 0x00000003
0x20002a3c 0x20002d02
0x20002a3b 0x20002b8c
0x20002a3a 0x00000000
0x20002a39 0x20005e10
0x20002a38 0x00000000
0x20002a37 0x00000000
0x20002a36 0x00000000
0x20002a35 0x00000000
0x20002a34 0x00000000
0x20002a33 0x00000000
0x20002a32 0x00000000
0x20002a31 0x00000000
0x20002a30 0x00000000
0x20002a2f 0x00000000
0x20002a2e 0x00000000
0x20002a2d 0x00000000
0x20002a2c 0x00000000
0x20002a2b 0x00000000
0x20002a2a 0x00000000
0x20002a29 0x00000000
0x20002a28 0x00000000
0x20002a27 0x00000000
0x20002a26 0x00000000
0x20002a25 0x00000000
0x20002a24 0x00060002
0x20002a23 0x00000000
0x20002a22 0x00000000
0x20002a21 0x00000000
0x20002a20 0x08006ecd
0x20002a1f 0x08006ecd
0x20002a1e 0x00000000
0x20002a1d 0x100001f0
0x20002a1c 0x2001daa0
0x20002a1b 0x00000000
0x20002a1a 0x00000000
0x20002a19 0x20002cd8
0x20002a18 0x00000000
0x20002a17 0x00000000
0x20002a16 0x00000000
0x20002a15 0x20002b58
0x20002a14 0x00000000
0x20002a13 0x00000000
0x20002a12 0x00000000
0x20002a11 0x20002b48
0x20002a10 0x20002b68
0x20002a0f 0x00000000
0x20002a0e 0x00000000
0x20002a0d 0x20002b38
0x20002a0c 0x20002b58
0x20002a0b 0x00000000
0x20002a0a 0x00000000
0x20002a09 0x20002b28
0x20002a08 0x20002b48
0x20002a07 0x00000000
0x20002a06 0x00000000
0x20002a05 0x20002b18
0x20002a04 0x20002b38
0x20002a03 0x00000000
0x20002a02 0x00000000
0x20002a01 0x20002b08
0x20002a00 0x20002b28
0x200029ff 0x00000000
0x200029fe 0x00000000
0x200029fd 0x20022ba8
0x200029fc 0x20002b18
0x200029fb 0x00000000
0x200029fa 0x00000000
0x200029f9 0x20002ae8
0x200029f8 0x20022ba8
0x200029f7 0x00000000
0x200029f6 0x00000000
0x200029f5 0x20002ad8
0x200029f4 0x20002af8
0x200029f3 0x00000000
0x200029f2 0x00000000
0x200029f1 0x20002ac8
0x200029f0 0x20002ae8<-- Interrupt sp top
0x200029ef 0x00000000
0x200029ee 0x00000000
0x200029ed 0x20002ab8
0x200029ec 0x20002ad8
0x200029eb 0x00000000
0x200029ea 0x00000000
0x200029e9 0x200119f8
0x200029e8 0x20002ac8
0x200029e7 0x00000000
0x200029e6 0x00000000
0x200029e5 0x200201d8
0x200029e4 0x200119f8
0x200029e3 0x00000000
0x200029e2 0x00000000
0x200029e1 0x2001d918
0x200029e0 0x200201d8
0x200029df 0x00000000
0x200029de 0x00000000
0x200029dd 0x200206e8
0x200029dc 0x2001d918
0x200029db 0x00000000
0x200029da 0x00000000
0x200029d9 0x20002a68
0x200029d8 0x200206e8
0x200029d7 0x00000000
0x200029d6 0x00000000
0x200029d5 0x20002a58
0x200029d4 0x20002a78
0x200029d3 0x00000000
0x200029d2 0x00000000
0x200029d1 0x10004678
0x200029d0 0x20002a68
0x200029cf 0x00000000
0x200029ce 0x00000000
0x200029cd 0x00000000
0x200029cc 0x10004578
0x200029cb 0x00000000
0x200029ca 0x00000000
0x200029c9 0x00000002
0x200029c8 0x1000fff8
0x200029c7 0x2002fff8
0x200029c6 0x10000000
0x200029c5 0x20005e30
0x200029c4 0x0003a1d0
0x200029c3 0x00000000
0x200029c2 0x0000ffff
0x200029c1 0x00000000
0x200029c0 0x00000000
0x200029bf 0x00000000
0x200029be 0x00000000
0x200029bd 0x00000001
0x200029bc 0x10000010
0x200029bb 0x0000ffff
0x200029ba 0x00000000
0x200029b9 0x00000000
0x200029b8 0x00000000
0x200029b7 0x00000000
0x200029b6 0x00000001
0x200029b5 0x00000001
0x200029b4 0x2001b1f4
0x200029b3 0x08004f53
0x200029b2 0x00000000
0x200029b1 0x2001a410
0x200029b0 0x00000001
0x200029af 0x2001b1f4
0x200029ae 0x000000f0
0x200029ad 0x080059e9
0x200029ac 0x080059f5
0x200029ab 0x08005a17
0x200029aa 0x2001a4f8
0x200029a9 0x00000003
0x200029a8 0x08005a0f
0x200029a7 0x200029c8
0x200029a6 0x0800b912
0x200029a5 0x0807ee1b
0x200029a4 0x2001b2c8
0x200029a3 0x0800c105
0x200029a2 0x2001a4f8
0x200029a1 0x00000000
0x200029a0 0x000000f0<-- Interrupt sp
0x2000299f 0x0800595d
0x2000299e 0x000000ab
0x2000299d 0x080b75b8
0x2000299c 0x20002e0c
0x2000299b 0x0800c105
0x2000299a 0x200029f0
0x20002999 0x2001a4f8
0x20002998 0x000000ab
0x20002997 0x08008fab
0x20002996 0x20000010
0x20002995 0x08005ae9
0x20002994 0x00000000
0x20002993 0x20014d40
0x20002992 0x2001ad0c
0x20002991 0x2001b1f4
0x20002990 0x200029f0
0x2000298f 0x200029a0
0x2000298e 0x00000119
0x2000298d 0x20014d40
0x2000298c 0x20000000
0x2000298b 0x08005d69
0x2000298a 0x20002960
0x20002989 0x20002960
0x20002988 0x00000000
0x20002987 0x08005d4b
0x20002986 0x0000005e
0x20002985 0x10007ae0
0x20002984 0x3eabd3c4
0x20002983 0x00000031
0x20002982 0x08013421
0x20002981 0x080069e5
0x20002980 0x08013421
0x2000297f 0x08006997
0x2000297e 0x20014d40
0x2000297d 0x2001ad0c
0x2000297c 0x000000ab
0x2000297b 0x20002d0c
0x2000297a 0x00000000
0x20002979 0x080057a1
0x20002978 0x20002944
0x20002977 0x080b7566
0x20002976 0x3eabd3c4
0x20002975 0x3b82278d
0x20002974 0x2000295c
0x20002973 0x00000004
0x20002972 0x08013421
0x20002971 0x08013401
0x20002970 0x0000000a
0x2000296f 0x08004665
0x2000296e 0x080bc8ad
0x2000296d 0x00000039
0x2000296c 0x00000004
0x2000296b 0x080130fb
0x2000296a 0x20002924
0x20002969 0x00000020
0x20002968 0x080069e5
0x20002967 0x080069f1
0x20002966 0x20002924
0x20002965 0x0000000a
0x20002964 0x0000000a
0x20002963 0x08004dbd
0x20002962 0x0000000a
0x20002961 0x08004665
0x20002960 0x00000010
0x2000295f 0x08004dbd
0x2000295e 0x00000038
0x2000295d 0x08004665
0x2000295c 0x00000010
0x2000295b 0x08004dbd
0x2000295a 0x00000035
0x20002959 0x08004665
0x20002958 0x00000010
0x20002957 0x08004dbd
0x20002956 0x00000031
0x20002955 0x08004665
0x20002954 0x00000010
0x20002953 0x41d00000
0x20002952 0x00000001
0x20002951 0x0000004e
0x20002950 0xbb60ff5e
0x2000294f 0x00000000
0x2000294e 0x00000000
0x2000294d 0x20002840
0x2000294c 0x20002938
0x2000294b 0x200028d0
0x2000294a 0x200028b8
0x20002949 0x0802d5e5
0x20002948 0xfffff6cb
0x20002947 0x00000049
0x20002946 0x200028a0
0x20002945 0x00000001
0x20002944 0x200028d0
0x20002943 0x1000a9c0
0x20002942 0x20003ab0
0x20002941 0x00000000
0x20002940 0xbb4f6618
0x2000293f 0xbc3747e7
0x2000293e 0xbb858284
0x2000293d 0x0808be19
0x2000293c 0xfffff6cb
0x2000293b 0x00000001
0x2000293a 0x10009fc0
0x20002939 0x080222bb
0x20002938 0x00000010
0x20002937 0x00000001
0x20002936 0x1000ad30
0x20002935 0x0800752b
0x20002934 0x2001b2a4
0x20002933 0x20014d40
0x20002932 0x2001b2b0
0x20002931 0x08010de5
0x20002930 0x1000a1f0
0x2000292f 0x08008b0f
0x2000292e 0x20014d40
0x2000292d 0x1000a268
0x2000292c 0x20005e10
0x2000292b 0x0800a14d
0x2000292a 0xfffff6cb
0x20002929 0x1000a1f0
0x20002928 0x20003708
0x20002927 0xb5c9715b
0x20002926 0xb4e3f35e
0x20002925 0x200027a0
0x20002924 0x00000001
0x20002923 0x00000003
0x20002922 0xb650a02b
0x20002921 0xb70f3315
0x20002920 0xb6220b0d
0x2000291f 0x00000000
0x2000291e 0x0033efdf
0x2000291d 0x080afbe3
0x2000291c 0x3f490082
0x2000291b 0x200028b8
0x2000291a 0x1000ac18
0x20002919 0xdeadbeef
0x20002918 0xdeadbeef
0x20002917 0xdeadbeef
0x20002916 0xdeadbeef
0x20002915 0xdeadbeef
0x20002914 0xdeadbeef
0x20002913 0xdeadbeef
0x20002912 0xdeadbeef
0x20002911 0xdeadbeef
0x20002910 0xdeadbeef
0x2000290f 0xdeadbeef
0x2000290e 0xdeadbeef
0x2000290d 0xdeadbeef
0x2000290c 0xdeadbeef
0x2000290b 0xdeadbeef
0x2000290a 0xdeadbeef
0x20002909 0xdeadbeef
0x20002908 0xdeadbeef
0x20002907 0xdeadbeef
0x20002906 0xdeadbeef
0x20002905 0xdeadbeef
0x20002904 0xdeadbeef
0x20002903 0xdeadbeef
0x20002902 0xdeadbeef
0x20002901 0xdeadbeef
0x20002900 0xdeadbeef
0x200028ff 0xdeadbeef
0x200028fe 0xdeadbeef
0x200028fd 0xdeadbeef
0x200028fc 0xdeadbeef
0x200028fb 0xdeadbeef
0x200028fa 0xdeadbeef
0x200028f9 0xdeadbeef
0x200028f8 0xdeadbeef
0x200028f7 0x00000000
0x200028f6 0x00000000
0x200028f5 0x00000000
0x200028f4 0x00000000
0x200028f3 0x00000000
0x200028f2 0x00000000
0x200028f1 0x00000000
0x200028f0 0x00000000
0x200028ef 0x00000000
0x200028ee 0x00020001
0x200028ed 0x2001b540
0x200028ec 0xfc481400
0x200028eb 0x989a0000
0x200028ea 0x00000000
0x200028e9 0x42f70000
0x200028e8 0x00000000
0x200028e7 0x91000001
0x200028e6 0x13770f00
0x200028e5 0x080d6ae0
0x200028e4 0x00000000
0x200028e3 0x080bb074
0x200028e2 0x80000020
0x200028e1 0x00000060
0x200028e0 0x3f75cf3f
0x200028df 0x71200030
0x200028de 0x73616962
0x200028dd 0x5f726f73
0x200028dc 0x6e65732f
0x200028db 0x6a626f2f
0x200028da 0x80000020
0x200028d9 0x00000020
0x200028d8 0xff151c07
0x200028d7 0x855e9682
0x200028d6 0xd2fdb5dd
0x200028d5 0x00000000
0x200028d4 0x0000004b
0x200028d3 0x00000002
0x200028d2 0x80000020
User sp memory region, stack pointer lies within stack
0x2001b379 0x00020001
0x2001b378 0x2001b540
0x2001b377 0xfc481400
0x2001b376 0x989a0000
0x2001b375 0x00000000
0x2001b374 0x42f70000
0x2001b373 0x00000000
0x2001b372 0x91000001
0x2001b371 0x13770f00
0x2001b370 0x080d6ae0
0x2001b36f 0x00000000
0x2001b36e 0x080bb074
0x2001b36d 0x80000020
0x2001b36c 0x00000060
0x2001b36b 0x3f75cf3f
0x2001b36a 0x71200030
0x2001b369 0x73616962
0x2001b368 0x5f726f73
0x2001b367 0x6e65732f
0x2001b366 0x6a626f2f
0x2001b365 0x80000020
0x2001b364 0x00000020
0x2001b363 0xff151c07
0x2001b362 0x855e9682
0x2001b361 0xd2fdb5dd
0x2001b360 0x00000000
0x2001b35f 0x0000004b
0x2001b35e 0x00000002
0x2001b35d 0x80000020
0x2001b35c 0x00000020
0x2001b35b 0x4e6bf37f
0x2001b35a 0x8334e465
0x2001b359 0xa7289629
0x2001b358 0x00000000
0x2001b357 0x0000004b
0x2001b356 0x000000b2
0x2001b355 0x80000020
0x2001b354 0x00000020
0x2001b353 0xedbcb8f7
0x2001b352 0xc7fd0fbe
0x2001b351 0xe537f9ed
0x2001b350 0x00000000
0x2001b34f 0x000000ff
0x2001b34e 0x0000010c
0x2001b34d 0x80000020
0x2001b34c 0x00000020
0x2001b34b 0x8be802fc
0x2001b34a 0x2055f000
0x2001b349 0x9bc03e77
0x2001b348 0x00000000
0x2001b347 0x0000004b
0x2001b346 0x00000054
0x2001b345 0x80000020
0x2001b344 0x00000020
0x2001b343 0x99bdc971
0x2001b342 0x20865f7c
0x2001b341 0xfca45ea8
0x2001b340 0x00000000
0x2001b33f 0x0000004b
0x2001b33e 0x00000014
0x2001b33d 0x80000020
0x2001b33c 0x00000020
0x2001b33b 0xa7e688de
0x2001b33a 0x6d3af334
0x2001b339 0x47fc5927
0x2001b338 0x00000000
0x2001b337 0x0000004b
0x2001b336 0x00000003
0x2001b335 0x80000020
0x2001b334 0x00000020
0x2001b333 0xe9a54166
0x2001b332 0xd9e78ffb
0x2001b331 0xffeffda4
0x2001b330 0x00000000
0x2001b32f 0x0000004b
0x2001b32e 0x00000000
0x2001b32d 0x80000020
0x2001b32c 0x00000020
0x2001b32b 0x180f898a
0x2001b32a 0x7c9e17b1
0x2001b329 0x9745ea5a
0x2001b328 0x00000000
0x2001b327 0x0000004b
0x2001b326 0x00000063
0x2001b325 0x80000020
0x2001b324 0x00000020
0x2001b323 0x6e5b8370
0x2001b322 0x2be14dd5
0x2001b321 0x97e25224
0x2001b320 0x00000000
0x2001b31f 0x0000004b
0x2001b31e 0x00000003
0x2001b31d 0x80000020
0x2001b31c 0x00000020
0x2001b31b 0xe93e8596
0x2001b31a 0x16bb9cc7
0x2001b319 0x8cd24e1e
0x2001b318 0x00000000
0x2001b317 0x0000004b
0x2001b316 0x00000000
0x2001b315 0x80000040
0x2001b314 0x00000020
0x2001b313 0xa75b0cc7
0x2001b312 0xe389d4ca
0x2001b311 0xa3000000
0x2001b310 0x0030746e
0x2001b30f 0x696f7074
0x2001b30e 0x65735f73
0x2001b30d 0x65746172
0x2001b30c 0x5f656c63
0x2001b30b 0x69686576
0x2001b30a 0x20015020
0x2001b309 0x080bf528
0x2001b308 0x00000001
0x2001b307 0x00000000
0x2001b306 0x1000ff00
0x2001b305 0x800006b0
0x2001b304 0x00000040
0x2001b303 0xafb529de
0x2001b302 0xde006c6f
0x2001b301 0x72746e6f
0x2001b300 0x635f7474
0x2001b2ff 0x615f636d
0x2001b2fe 0x00000000
0x2001b2fd 0x2001b3a4
0x2001b2fc 0xdeadbeef
0x2001b2fb 0x00000000
0x2001b2fa 0x00000000
0x2001b2f9 0x08007f23
0x2001b2f8 0x00000000
0x2001b2f7 0x00000000
0x2001b2f6 0x00000000
0x2001b2f5 0x00000000
0x2001b2f4 0x00000000
0x2001b2f3 0x00000000
0x2001b2f2 0x00000000
0x2001b2f1 0x00000101
0x2001b2f0 0x00000000
0x2001b2ef 0x00000000
0x2001b2ee 0x00000000
0x2001b2ed 0x00000000
0x2001b2ec 0x00000000
0x2001b2eb 0x00000000
0x2001b2ea 0x00000000
0x2001b2e9 0x01000000
0x2001b2e8 0x08007f08
0x2001b2e7 0x00000000
0x2001b2e6 0x00000000
0x2001b2e5 0x00000000
0x2001b2e4 0x00000000
0x2001b2e3 0x00000000
0x2001b2e2 0x00000000
0x2001b2e1 0xdeadbeef
0x2001b2e0 0xdeadbeef
0x2001b2df 0xdeadbeef
0x2001b2de 0xdeadbeef
0x2001b2dd 0xdeadbeef
0x2001b2dc 0xdeadbeef
0x2001b2db 0xdeadbeef
0x2001b2da 0x2001a880
0x2001b2d9 0x00000101
0x2001b2d8 0x00000000
0x2001b2d7 0x0000000c
0x2001b2d6 0xdeadbeef
0x2001b2d5 0xdeadbeef
0x2001b2d4 0xdeadbeef
0x2001b2d3 0x00000000
0x2001b2d2 0x002ec1cc
0x2001b2d1 0x00000054
0x2001b2d0 0xdeadbeef
0x2001b2cf 0xdeadbeef
0x2001b2ce 0xdeadbeef
0x2001b2cd 0x0807ee1b
0x2001b2cc 0x0033f01e
0x2001b2cb 0x00000001
0x2001b2ca 0x2001a0d0
0x2001b2c9 0x452292ed
0x2001b2c8 0x080d9210<-- User sp
0x2001b2c7 0x00000000
0x2001b2c6 0x20000010
0x2001b2c5 0x00000000
0x2001b2c4 0x00000000
0x2001b2c3 0x405f66f4
0x2001b2c2 0x00000000
0x2001b2c1 0x00000000
0x2001b2c0 0x00000000
0x2001b2bf 0x00000000
0x2001b2be 0x00000000
0x2001b2bd 0x00000000
0x2001b2bc 0x00000000
0x2001b2bb 0x00000000
0x2001b2ba 0x00000000
0x2001b2b9 0x00000000
0x2001b2b8 0x00000000
0x2001b2b7 0x00000000
0x2001b2b6 0x00000000
0x2001b2b5 0x21000000
0x2001b2b4 0x0800b912
0x2001b2b3 0x0807ee1b
0x2001b2b2 0x0800c105
0x2001b2b1 0x080d9210
0x2001b2b0 0x2001a410
0x2001b2af 0x452292ed
0x2001b2ae 0x452292ed
0x2001b2ad 0x00000000
0x2001b2ac 0x00000000
0x2001b2ab 0x00000000
0x2001b2aa 0x00000000
0x2001b2a9 0x00000000
0x2001b2a8 0x00000000
0x2001b2a7 0x00000000
0x2001b2a6 0x00000000
0x2001b2a5 0x00000000
0x2001b2a4 0x00000000
0x2001b2a3 0x00000000
0x2001b2a2 0x00000000
0x2001b2a1 0x3b03126f
0x2001b2a0 0x358637bd
0x2001b29f 0x3eabd3c4
0x2001b29e 0x3b82278d
0x2001b29d 0xffffffe9
0x2001b29c 0x2001a4f8
0x2001b29b 0x00000000
0x2001b29a 0x00000000
0x2001b299 0x0033e09a
0x2001b298 0x00000000
0x2001b297 0x2001a410
0x2001b296 0x00000001
0x2001b295 0x2001a0d0
0x2001b294 0x000000f0
0x2001b293 0x2001b2c8
0x2001b292 0x2001b3c0
0x2001b291 0x0800bb25
0x2001b290 0x20015020
0x2001b28f 0x00000000
0x2001b28e 0x00000000
0x2001b28d 0x08022515
0x2001b28c 0x080228c9
0x2001b28b 0x00000000
0x2001b28a 0x20015020
0x2001b289 0x0800752b
0x2001b288 0x20015030
0x2001b287 0x00000000
0x2001b286 0x00000000
0x2001b285 0x080073f1
0x2001b284 0x000000f0
0x2001b283 0x00000000
0x2001b282 0x00000000
0x2001b281 0x00000000
0x2001b280 0x00000000
0x2001b27f 0x00000000
0x2001b27e 0x00000000
0x2001b27d 0x00000000
0x2001b27c 0x00000000
0x2001b27b 0x21000000
0x2001b27a 0x08006cca
0x2001b279 0x08006cb1
0x2001b278 0x00000061
0x2001b277 0x2001b245
0x2001b276 0x00000076
0x2001b275 0x2000a2d4
0x2001b274 0x2001b245
0x2001b273 0x00000000
0x2001b272 0x00000000
0x2001b271 0x00000000
0x2001b270 0x00000000
0x2001b26f 0x00000000
0x2001b26e 0x00000000
0x2001b26d 0x00000000
0x2001b26c 0x00000000
0x2001b26b 0x00000000
0x2001b26a 0x00000000
0x2001b269 0x00000000
0x2001b268 0x00000000
0x2001b267 0x3b03126f
0x2001b266 0x358637bd
0x2001b265 0x3eabd3c4
0x2001b264 0x3b82278d
0x2001b263 0xffffffe9
0x2001b262 0x2001a4f8
0x2001b261 0x00000000
0x2001b260 0x10004f50
0x2001b25f 0x00000000
0x2001b25e 0x1000bee0
0x2001b25d 0x10004fd0
0x2001b25c 0x2001b20c
0x2001b25b 0x2000a2c0
0x2001b25a 0x000000f0
0x2001b259 0x2001b1e0
0x2001b258 0x00000000
0x2001b257 0x2001b0d8
0x2001b256 0x00000003
0x2001b255 0x00000003
0x2001b254 0x00000000
0x2001b253 0x00000000
0x2001b252 0x00000000
0x2001b251 0x00000000
0x2001b250 0x00000000
0x2001b24f 0x00000000
0x2001b24e 0x00000000
0x2001b24d 0x00000000
0x2001b24c 0x00000000
0x2001b24b 0x2001b0bc
0x2001b24a 0x00000001
0x2001b249 0x00000004
0x2001b248 0x00000000
0x2001b247 0x00000000
0x2001b246 0x00000000
0x2001b245 0x00000000
0x2001b244 0x2001b0a0
0x2001b243 0x00000001
0x2001b242 0x00000004
0x2001b241 0x00000000
0x2001b240 0x00000000
0x2001b23f 0x00000000
0x2001b23e 0x00000000
0x2001b23d 0x20014f10
0x2001b23c 0x20007650
0x2001b23b 0x10004fd0
0x2001b23a 0x2001b174
0x2001b239 0x100082e0
0x2001b238 0x000000f0
0x2001b237 0x2001b070
0x2001b236 0x00000001
0x2001b235 0x00000003
0x2001b234 0x00000000
0x2001b233 0x00000000
0x2001b232 0x00000000
0x2001b231 0x2001b058
0x2001b230 0x00000001
0x2001b22f 0x00000003
0x2001b22e 0x00000000
0x2001b22d 0x00000000
0x2001b22c 0x00000000
0x2001b22b 0x2001b040
0x2001b22a 0x00000001
0x2001b229 0x00000003
0x2001b228 0x00000000
0x2001b227 0x00000000
0x2001b226 0x00000000
0x2001b225 0x0807e77d
0x2001b224 0x2001a0d0
0x2001b223 0x00000000
0x2001b222 0x358637bd
0x2001b221 0x00000000
0x2001b220 0x00000000
0x2001b21f 0x00000000
0x2001b21e 0x00000000
0x2001b21d 0x2001a0d0
0x2001b21c 0x00000000
0x2001b21b 0x00000000
0x2001b21a 0x00000000
0x2001b219 0x00000000
0x2001b218 0x00000000
0x2001b217 0x00000000
0x2001b216 0x00000000
0x2001b215 0x00000000
0x2001b214 0x00000000
0x2001b213 0x00000000
[hardfault_log] – 2000-01-01-00:00:03 END Fault Log –

1 Like
#2

Hi
Without seeing the code I cannot say much. But as you can see the crash happens in the mc_att_control module, so likely due to your changes.
It’s generally best to test and debug these things in SITL first. Did you do that?

#3

Thanks for the reply and Sorry for the delay. I was trying to publish a custom topic in mc_att_control and it is working without hard faults. But now I have another problem. I am trying to attempt something similar in mc_pos_control but the custom topic is not being published. Here is my code:

    float gainkx=1.5f;
    math::Vector<3> Fb;
    Fb(0)=0.0f;
    Fb(1)=0.0f;
    Fb(2)=thrust_sp_body_prev;
    math::Vector<3> lx;
    math::Vector<3> invM;
    lx(0)=gainkx;
    lx(1)=gainkx;
    lx(2)=gainkx;
    invM(0)=1.0f;
    invM(1)=1.0f;
    invM(2)=1.0f;

    math::Vector<3> lmx;
    lmx(0)=gainkx*_vel(0);
    lmx(1)=gainkx*_vel(1);
    lmx(2)=gainkx*_vel(2);

   // float m=1;

    math::Vector<3> dzxdot;
    math::Vector<3> dzx;
    math::Vector<3> gmat;
    gmat(0)=0;
    gmat(1)=0;
    gmat(2)=_params.thr_hover;
    dzxdot(0)=-lx(0)*(invM(0)*(lmx(0)+prev_dzx(0))+gmat(0)-invM(0)*_R(0,2)*Fb(2));
    dzxdot(1)=-lx(1)*(invM(1)*(lmx(1)+prev_dzx(1))+gmat(1)-invM(1)*_R(1,2)*Fb(2));
    dzxdot(2)=-lx(2)*(invM(2)*(lmx(2)+prev_dzx(2))+gmat(2)-invM(2)*_R(2,2)*Fb(2));
    dzx(0)=prev_dzx(0)+_dt*dzxdot(0);
    dzx(1)=prev_dzx(1)+_dt*dzxdot(1);
    dzx(2)=prev_dzx(2)+_dt*dzxdot(2);
    dxcap=dzx+lmx;

if (_control_mode.flag_control_acceleration_enabled && _pos_sp_triplet.current.acceleration_valid) {
	thrust_sp = math::Vector<3>(_pos_sp_triplet.current.a_x, _pos_sp_triplet.current.a_y, _pos_sp_triplet.current.a_z);

} else {
	thrust_sp = vel_err.emult(_params.vel_p) + _vel_err_d.emult(_params.vel_d)
                        + _thrust_int - math::Vector<3>(0.0f, 0.0f, _params.thr_hover)+dxcap;
}

    dist_est_pos.timestamp = hrt_absolute_time();
    dist_est_pos.dx=dxcap(0);
    dist_est_pos.dy=dxcap(1);
    dist_est_pos.dz=dxcap(2);

    if (dist_est_pos_pub != nullptr) {
            orb_publish(ORB_ID(dist_est_position), dist_est_pos_pub, &dist_est_pos);

    } else{
            dist_est_pos_pub = orb_advertise(ORB_ID(dist_est_position), &dist_est_pos);
    }

    thrust_sp_body_prev=thrust_sp(2);
    prev_dzx=dzx;

The code has been written in void MulticopterPositionControl::calculate_thrust_setpoint() function of mc_pos_control module but the topic dist_est_position is not being published. I attempted something similar in MulticopterAttitudeControl::control_attitude_rates(float dt) function in mc_att_control module and the custom topic(dist_est_angle) was publishing correctly but the topic dist_est_position is not being published at all. Any help will be greatly appreciated.

#4

Did you validate that the MulticopterPositionControl::calculate_thrust_setpoint() method is executed?

#5

I was checking with RC input and the topic was not getting published. But when I am doing SITL in OFFBOARD mode the topic is being published. It seems that the MulticopterPositionControl::calculate_thrust_setpoint() method is executed only in OFFBOARD mode. I have not tested this in hardware but it is likely that the topic will be published if operated in OFFBOARD mode. I will be try this in actual hardware and post the updates.

#6

I tested the code in hardware and the topic is being published. So the MulticopterPositionControl::calculate_thrust_setpoint() method is executed only in OFFBOARD mode. This is what I needed. Problem solved.