Forum: ARM programming with GCC/GNU tools STM32F4 IMPRECISERR, trouble debugging

Author: SGT Jacobs (rinion)
Posted on:

Rate this post
0 useful
not useful
First off I did make a Debug Fault Handler, this is what I am getting

r0 = 1200        0x000004B0
r1 = 0           0x00000000
r2 = 1200        0x000004B0
r3 = 1           0x00000001
r12 = 0           0x00000000
lr = 134228401   0x080029B1
pc = 134228410   0x080029BA
psr = 553648128   0x21000000
OST = 536881104   0x200027D0
HFSR = 1073741824  0x40000000
CFSR = 1024        0x00000400 Showing BUSFAULT IMPRECISERR
DFSR = 0           0x00000000
MMFAR = 3758157108  0xE000ED34
BFAR = 3758157112  0xE000ED38
AFSR = 0           0x00000000
PSP = 536881200   0x20002830
SHCSR = 0           0x00000000
FPSCR = 0           0x00000000
MSP = 536898808   0x20006CF8
XPSR = 3           0x00000003
APSR = 0           0x00000000
IPSR = 3           0x00000003
CONTROL = 4           0x00000004
s0 = 67119376    0x04002910
s1 = 536881455   0x2000292F
s2 = 10520       0x00002918
s3 = 536902072   0x200079B8
s4 = 536881440   0x20002920
s5 = 134225495   0x08001E57
s6 = 0           0x00000000
s7 = 0           0x00000000
s8 = 0           0x00000000
s9 = 4294967257  0xFFFFFFD9
s10 = 3256614912  0xC21C0000
s11 = 29245       0x0000723D
s12 = 1200        0x000004B0
s13 = 0           0x00000000
s14 = 1200        0x000004B0
s15 = 0           0x00000000
end = 3735936685  0xDEADDEAD

Below is the thread.  I am using a photocell with this program and it is 
hooked up to the ADC, It works fine when gradual changes occur, but 
throws a fault, when there is a spike or I go to low.  Not sure if I 
went back far enough in the stack from PC to show where things may have 
gone wrong.
Any help would be helpful, and extra info can be provided
[code]0x08002834:   str r0, [r7, #60]       ; 0x3c
1373                }
0x08002836:   ldr r3, [pc, #56]       ; (0x8002870 <processParam+708>)
0x08002838:   mov.w r2, #1
0x0800283c:   str r2, [r3, #0]
1374                case APPDATA_PARAM_TIT:
0x0800283e:   b.n 0x800298c <processParam+992>
0x08002840:   lsls r4, r4, #8
0x08002842:   movs r2, #56    ; 0x38
0x08002844:   lsls r5, r5, #29
0x08002846:   lsrs r6, r1, #32
0x08002848:   lsls r4, r2, #6
0x0800284a:   movs r0, #0
1384                                &u8Status);
0x0800284c:   lsls r4, r0, #5
0x0800284e:   movs r2, #56    ; 0x38
0x08002850:   lsls r0, r2, #6
0x08002852:   movs r0, #0
0x08002854:   lsls r0, r1, #5
0x08002856:   movs r2, #56    ; 0x38
0x08002858:   cmp r2, #29
0x0800285a:   movs r0, #0
0x0800285c:   lsls r4, r1, #5
0x0800285e:   movs r2, #56    ; 0x38
0x08002860:   lsls r0, r2, #5
0x08002862:   movs r2, #56    ; 0x38
1385                        target = XADC_read();
0x08002864:   lsls r4, r2, #5
0x08002866:   movs r2, #56    ; 0x38
0x08002868:   lsls r0, r3, #5
0x0800286a:   movs r2, #56    ; 0x38
0x0800286c:   lsls r4, r3, #5
0x0800286e:   movs r2, #56    ; 0x38
0x08002870:   lsls r0, r4, #5
0x08002872:   movs r2, #56    ; 0x38
0x08002874:   ldr r0, [pc, #648]      ; (0x8002b00 <processParam+1364>)
0x08002876:   bl 0x8000430 <CJ_readColdJunction>
0x0800287a:   mov r3, r0
0x0800287c:   cmp r3, #0
1387                        /* Adjust ADC reading */
0x0800287e:   beq.n 0x80028fe <processParam+850>
0x08002880:   ldr r3, [pc, #636]      ; (0x8002b00 <processParam+1364>)
0x08002882:   ldrh r3, [r3, #0]
0x08002884:   sxth r3, r3
0x08002886:   cmp r3, #0
0x08002888:    ; <UNDEFINED> instruction: 0xf103da01
0x0800288c:   b 0x93c34b0
0x08002890:   addslt r0, r10, #-1946157053    ; 0x8c000003
0x08002894:   mulshi r10, r10, r11
0x08002898:   ldmdahi r11, {r0, r3, r4, r7, r8, r9, r11, lr}
0x0800289c:    ; <UNDEFINED> instruction: 0xf107b21a
0x080028a0:   ldmmi r8, {r0, r1, r2, r3, r4, r8, r9}
0x080028a4:    ; <UNDEFINED> instruction: 0x461a4611
0x080028a8:    ; <UNDEFINED> instruction: 0xff24f000
0x080028ac:   blmi 0x65940bc
0x080028b0:    ; <UNDEFINED> instruction: 0xf005601a
0x080028b4:    ; <UNDEFINED> instruction: 0x4603f9d5
0x080028b8:   blmi 0x64db8ac
0x080028bc:   blvs 0x7e9c930
0x080028c0:   mvnsvs r1, #13828096    ; 0xd30000
0x080028c4:   tsteq pc, #-1073741823  ; 0xc0000001
0x080028c8:   blvs 0x7e54b08
1391                        target /= 32;
0x080028cc:   mov r2, r3
0x080028ce:   bl 0x80032dc <LOOKUP_tableLookUp+40>
0x080028d2:   str r0, [r7, #60]       ; 0x3c
0x080028d4:   ldr r2, [r7, #60]       ; 0x3c
0x080028d6:   mov r3, r2
1392                        BB_SET_BIT(BB_OFFSET_APP_PROCESSPARAM, 8);
0x080028d8:   mov.w r3, r3, lsl #2
0x080028dc:   adds r3, r3, r2
0x080028de:   mov.w r3, r3, lsl #1
1393                    }
0x080028e0:   lsls r3, r0, #13
0x080028e2:   str r3, [r7, #60]       ; 0x3c
0x080028e4:   ldr r3, [r7, #60]       ; 0x3c
1394                    else
0x080028e6:   cmp r3, #0
0x080028e8:   bge.n 0x80028ee <processParam+834>
0x080028ea:   add.w r3, r3, #31
1397                        coldTemp = -9999;
0x080028ee:   mov.w r3, r3, asr #5
0x080028f2:   str r3, [r7, #60]       ; 0x3c
0x080028f4:   ldr r3, [pc, #532]      ; (0x8002b0c <processParam+1376>)
1398                        adjust = -9999;
0x080028f6:   mov.w r2, #1
0x080028fa:   str r2, [r3, #0]
0x080028fc:   b.n 0x800292c <processParam+896>
0x080028fe:   ldrsh.w r3, [r7, #86]   ; 0x56
1400                        BB_SET_BIT(BB_OFFSET_APP_PROCESSPARAM, 9);
0x08002900:   adds r0, #86    ; 0x56
0x08002902:   ldr r2, [pc, #524]      ; (0x8002b10 <processParam+1380>)
0x08002904:   mov.w r1, #0
0x08002908:   strb r1, [r2, r3]
0x0800290a:   ldr r3, [pc, #500]      ; (0x8002b00 <processParam+1364>)
0x0800290c:   movw r2, #55537 ; 0xd8f1
1401                    }
0x08002910:   strh r2, [r3, #0]
0x08002912:   ldr r3, [pc, #500]      ; (0x8002b08 <processParam+1372>)
0x08002914:   ldr r2, [pc, #508]      ; (0x8002b14 <processParam+1384>)
0x08002916:   str r2, [r3, #0]
0x08002918:   ldr r3, [pc, #488]      ; (0x8002b04 <processParam+1368>)
0x0800291a:   ldr r3, [r3, #4]
0x0800291c:   add.w r3, r3, #4
1402        #if 0
0x08002920:   ldr r3, [r3, #0]
0x08002922:   str r3, [r7, #60]       ; 0x3c
0x08002924:   ldr r3, [pc, #496]      ; (0x8002b18 <processParam+1388>)
0x08002926:   mov.w r2, #1
0x0800292a:   str r2, [r3, #0]
0x0800292c:   ldr r3, [pc, #492]      ; (0x8002b1c <processParam+1392>)
0x0800292e:   ldr r3, [r3, #0]
1403                    target = XADC_read();
0x08002930:   ldr r3, [r3, #124]      ; 0x7c
0x08002932:   and.w r3, r3, #4
0x08002936:   cmp r3, #0
0x08002938:   beq.n 0x800296a <processParam+958>
0x0800293a:   ldr r2, [r7, #60]       ; 0x3c
0x0800293c:   mov r3, r2
1405                    /* Adjust ADC reading */
0x0800293e:   mov.w r3, r3, lsl #3
0x08002942:   adds r3, r3, r2
0x08002944:   str r3, [r7, #60]       ; 0x3c
0x08002946:   ldr r3, [r7, #60]       ; 0x3c
0x08002948:   ldr r2, [pc, #468]      ; (0x8002b20 <processParam+1396>)
1406                    target = LOOKUP_tableLookUp(&XADC_typeKDegC, 
target, &u8Status);
0x0800294a:   smull r1, r2, r2, r3
0x0800294e:   mov.w r2, r2, asr #1
0x08002952:   mov.w r3, r3, asr #31
0x08002956:   subs r3, r2, r3
0x08002958:   str r3, [r7, #60]       ; 0x3c
0x0800295a:   ldr r3, [r7, #60]       ; 0x3c
0x0800295c:   add.w r3, r3, #320      ; 0x140
1407                    target *= 10;
0x0800295e:   strb r0, [r4, #14]
0x08002960:   str r3, [r7, #60]       ; 0x3c
0x08002962:   ldr r3, [pc, #448]      ; (0x8002b24 <processParam+1400>)
0x08002964:   mov.w r2, #1
1408                    target /= 32;
0x08002966:   lsls r1, r0, #8
0x08002968:   str r2, [r3, #0]
0x0800296a:   ldr r3, [pc, #444]      ; (0x8002b28 <processParam+1404>)
0x0800296c:   mov.w r2, #1
0x0800296e:   lsls r1, r0, #8
0x08002970:   str r2, [r3, #0]
0x08002972:   b.n 0x800298c <processParam+992>
0x08002974:   ldr r3, [pc, #436]      ; (0x8002b2c <processParam+1408>)
1411                    if (APPDATA_IS_FAHRENHEIT)
0x08002976:   mov.w r2, #1
1415                        target += 320;
0x08002978:   lsls r1, r0, #8
0x0800297a:   str r2, [r3, #0]
0x0800297c:   mov.w r0, #9
1416                        BB_SET_BIT(BB_OFFSET_APP_PROCESSPARAM, 10);
0x08002980:   ldr r1, [pc, #428]      ; (0x8002b30 <processParam+1412>)
0x08002982:   mov.w r2, #5
0x08002986:   bl 0x80e0000 <RTERR_displayErrorId>
0x0800298a:   nop
0x0800298c:   ldrsh.w r4, [r7, #86]   ; 0x56
1417                    }
0x0800298e:   eors r6, r2
1422                {
0x08002990:   ldr r3, [r7, #60]       ; 0x3c
0x08002992:   add.w r3, r3, #5
0x08002996:   ldr r2, [pc, #392]      ; (0x8002b20 <processParam+1396>)
0x08002998:   smull r1, r2, r2, r3
0x0800299c:   mov.w r2, r2, asr #2
0x080029a0:   mov.w r3, r3, asr #31
0x080029a4:   subs r3, r2, r3
0x080029a6:   mov r0, r3
0x080029a8:   ldr r1, [r7, #80]       ; 0x50
0x080029aa:   ldr r2, [r7, #76]       ; 0x4c
0x080029ac:   bl 0x8003284 <limitParam+40>
0x080029b0:   mov r2, r0
0x080029b2:   ldr r3, [pc, #384]      ; (0x8002b34 <processParam+1416>)
0x080029b4:   str.w r2, [r3, r4, lsl #2]
0x080029b8:   ldrb r3, [r7, #7]
0x080029ba:   cmp r3, #1
1427            }/* End of Switch */
0x080029bc:   bne.n 0x80029d0 <processParam+1060>
0x080029be:   ldr r3, [pc, #376]      ; (0x8002b38 <processParam+1420>)
0x080029c0:   ldr r3, [r3, #0]
1429            /* set and limit*/
0x080029c2:   cmp.w r3, #4294967295
0x080029c6:   beq.n 0x80029e0 <processParam+1076>
0x080029c8:   ldr r3, [pc, #364]      ; (0x8002b38 <processParam+1420>)
0x080029ca:   ldr r3, [r3, #0]
0x080029cc:   str r3, [r7, #60]       ; 0x3c
0x080029ce:   b.n 0x80029e0 <processParam+1076>
0x080029d0:   ldr r3, [pc, #356]      ; (0x8002b38 

Author: SGT Jacobs (rinion)
Posted on:

Rate this post
0 useful
not useful
I may have fixed the problem...or at least for now it seems.  Seemed 
only to throw a fault when I got a low signal from ADC.  I increased the 
sampling time, and that seemed to have fixed the issue for now.  Can the 
ADC be thrown off by possible white noise, and cause a IMPRECISERR?

Author: Dr. Sommer (Guest)
Posted on:

Rate this post
0 useful
not useful
You are a funny guy, you post a big bunch of disassembled code and 
expect anyone do debug it?! Why don't you post the C code?

The IMPRECISERR has nothing to do with the ADC and is solely caused by 
the  Cortex Core and its bus. Quoting from the ARMv7M Architechture 
Reference Manual (a must-read for Cortex-M4 developers):

BusFault, bus error on data bus, imprecise
Imprecise bus error caused by an explicit memory access. The processor 
does not update the Bus Fault Address Register.

The error is caused by an error in your code which might get triggered 
by certain ADC values.

Author: SGT Jacobs (rinion)
Posted on:

Rate this post
0 useful
not useful
LOL,I posted the disassembly, because the IMPRECISERR usually deals with 
a STR somewhere if it was my code.  I would of posted my C code, but 
being RTOS, its not all straight forward.  And I know the ADC has 
nothing to do with the IMPRECISERR, but that is what I was wondering if 
the values maybe throwing it off.

Thanks though for clearing that up. My problem seemed to be an odd one, 
and I was having issues finding similar issues.  So far so good, seems 
by increasing the sampling time, it improved the issue, if not also 
fixed it.

Author: Dr. Sommer (Guest)
Posted on:

Rate this post
0 useful
not useful
SGT Jacobs wrote:
> LOL,I posted the disassembly, because the IMPRECISERR usually deals with
> a STR somewhere if it was my code.
Ah yes. But since the "str" is generated from C Code and that is 
generally much more readable, posting that would likely result in more 
helpful answers.
Posting a minimal compilable example in C that shows the problem also 
greatly increases the chances of getting help.

Author: gggggg (Guest)
Posted on:

Rate this post
0 useful
not useful
how change it to no-cooldawn or 0 timers skills

str r0, [r10, #56]

writeData(0x256ba4, 0x!!!!!!!!);


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.