KL03: Warning: Failed to read Memory & Problems with TPM Module

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KL03: Warning: Failed to read Memory & Problems with TPM Module

1,259 Views
sarastout-grand
Contributor III

Hello,

 

As of a couple days ago, whenever I compile any program (including the sample programs), I get the following warnings about failure to read memory in the compiler console:

 

SEGGER J-Link GDB Server V6.16d Command Line Version

 

JLinkARM.dll V6.16d (DLL compiled Jun 21 2017 19:08:15)

 

-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      localhost only
Generate logfile:              off
Verify download:               on
Init regs on start:            on
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 MKL03Z32xxx4
Target interface:              SWD
Target interface speed:        30kHz
Target endian:                 little

 

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled Jun 16 2017 16:15:10
Hardware: V9.30
S/N: 609300434
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 2.99 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00000000 (Data = 0x20000600)
Target interface speed set to 30 kHz
Resetting target
Halting target CPU...
...Target halted (PC = 0x000004E8)
R0 = 00040000, R1 = 00000001, R2 = 00040000, R3 = E000E100
R4 = 00000000, R5 = 00000000, R6 = F6FB6ABB, R7 = 200005F8
R8 = 42DA5BD1, R9 = 1D9C0D88, R10= 1FFF0600, R11= 00000000
R12= 0023C370, R13= 20000600, MSP= 20000600, PSP= 3F2F7DE4
R14(LR) = 0000075D, R15(PC) = 000004E8
XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000
CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00
Reading all registers
Select auto target interface speed (2000 kHz)
Flash breakpoints enabled
Semi-hosting enabled (Handle on BKPT)
Wrong client mask. Semihosting I/O not changed.
Downloading 192 bytes @ address 0x00000000 - Verified OK
Downloading 16 bytes @ address 0x00000400 - Verified OK
Downloading 1908 bytes @ address 0x00000410 - Verified OK
Downloading 8 bytes @ address 0x00000B84 - Verified OK
Downloading 4 bytes @ address 0x00000B8C - Verified OK
Downloading 4 bytes @ address 0x00000B90 - Verified OK
Downloading 100 bytes @ address 0x00000B94 - Verified OK
WARNING: Failed to read memory @ address 0x40038000
Read 4 bytes @ address 0x000004E8 (Data = 0xF000B672)
WARNING: Failed to read memory @ address 0x40038004
WARNING: Failed to read memory @ address 0x40038008
Read 2 bytes @ address 0x00000714 (Data = 0x2004)
Read 2 bytes @ address 0x00000714 (Data = 0x2004)
Resetting target
Halting target CPU...
...Target halted (PC = 0x000004E8)
Read 2 bytes @ address 0x00000714 (Data = 0x2004)
Read 2 bytes @ address 0x00000714 (Data = 0x2004)
Read 2 bytes @ address 0x00000714 (Data = 0x2004)
R0 = 00000000, R1 = F000300C, R2 = 00000400, R3 = 00000800
R4 = 20000160, R5 = FFFFFFFF, R6 = 00000000, R7 = 1FFFFF65
R8 = 42DA5BD1, R9 = 1D9C0D88, R10= 1FFF0600, R11= 00000000
R12= 0023C370, R13= 20000600, MSP= 20000600, PSP= 3F2F7DE4
R14(LR) = 1FFFFF5D, R15(PC) = 000004E8
XPSR 41000000, APSR 40000000, EPSR 01000000, IPSR 00000000
CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00
Reading all registers
Reading all registers
Read 4 bytes @ address 0x000004E8 (Data = 0xF000B672)
Setting breakpoint @ address 0x00000714, Size = 2, BPHandle = 0x0001
Starting target CPU...
...Breakpoint reached @ address 0x00000714
Reading all registers
Removing breakpoint @ address 0x00000714, Size = 2
Read 4 bytes @ address 0x00000714 (Data = 0xF0002004)
Reading 64 bytes @ address 0x200005C0
WARNING: Failed to read memory @ address 0x4003800C
WARNING: Failed to read memory @ address 0x40038014
WARNING: Failed to read memory @ address 0x40038010
WARNING: Failed to read memory @ address 0x40038018
WARNING: Failed to read memory @ address 0x40038050
WARNING: Failed to read memory @ address 0x40038084
WARNING: Failed to read memory @ address 0x40039000
WARNING: Failed to read memory @ address 0x40039004
WARNING: Failed to read memory @ address 0x40039008
WARNING: Failed to read memory @ address 0x4003900C
WARNING: Failed to read memory @ address 0x40039014
WARNING: Failed to read memory @ address 0x40039010
WARNING: Failed to read memory @ address 0x40039018
WARNING: Failed to read memory @ address 0x40039050
WARNING: Failed to read memory @ address 0x40039084
Read 1 bytes @ address 0x40064000 (Data = 0x40)
Read 1 bytes @ address 0x40064001 (Data = 0x01)
Read 1 bytes @ address 0x40064008 (Data = 0x00)
Read 1 bytes @ address 0x40064018 (Data = 0x00)
WARNING: Failed to read memory @ address 0x40038000
WARNING: Failed to read memory @ address 0x40038004
WARNING: Failed to read memory @ address 0x40038008
WARNING: Failed to read memory @ address 0x4003800C
WARNING: Failed to read memory @ address 0x40038014
WARNING: Failed to read memory @ address 0x40038010
WARNING: Failed to read memory @ address 0x40038018
WARNING: Failed to read memory @ address 0x40038050
WARNING: Failed to read memory @ address 0x40038084
WARNING: Failed to read memory @ address 0x40039000
WARNING: Failed to read memory @ address 0x40039004
WARNING: Failed to read memory @ address 0x40039008
WARNING: Failed to read memory @ address 0x4003900C
WARNING: Failed to read memory @ address 0x40039014
WARNING: Failed to read memory @ address 0x40039010
WARNING: Failed to read memory @ address 0x40039018
WARNING: Failed to read memory @ address 0x40039050
WARNING: Failed to read memory @ address 0x40039084
Read 1 bytes @ address 0x40064000 (Data = 0x40)
Read 1 bytes @ address 0x40064001 (Data = 0x01)
Read 1 bytes @ address 0x40064008 (Data = 0x00)
Read 1 bytes @ address 0x40064018 (Data = 0x00)

 

I'm not sure what I did to cause this. As you can see, I'm using the j-link GBD server. I had been using the j-link for over a month before these warnings started popping up. I have not found any help on-line.

 

Coincident with these warnings, I'm having trouble using the TPM module. I can't get the counter to increment, no matter what clock I use! Would this be related to these warnings? It seems like the memory addresses are those of the TPM module. Attached is my directory of code.

 

HELP!

 

Thanks,

 

Sara

Original Attachment has been moved to: KL03_Test_Board.zip

Labels (1)
0 Kudos
4 Replies

903 Views
mjbcswitzerland
Specialist V

Hi

I guess you have a TPM peripheral monitor window open in IAR that is causing these errors each time you connect/load. The debugger will be trying to read the TPM registers to fill out the window but can't because it isn't yet clocked. Close the peripheral window to see whether they go away. When you are sure that it is due to this just ignore them (they are probably normal).

Regards

Mark

0 Kudos

903 Views
sarastout-grand
Contributor III

Hi Mark,

I don’t see any superfluous peripheral windows open. As far as I can tell, I have the same set-up as I’ve always had in KDS. How can I tell if there are other peripheral windows open somewhere?

The interesting part is that I never had these warnings before last week. I obviously did something that caused them to happen, but I have no idea what. It’s also interesting to me that I can’t get the TPM timer to work when I’ve had it working with this exact code in the past…before I was getting these warnings. It seems to me that the warnings are linked to the TPM module not working.

Something is weird…

Sara

Sara Stout-Grandy, M.Eng., Ph.D., P.Eng.

Senior Hardware Designer

20 Angus Morton Dr., Bedford,

NS, Canada, B4B 0L9

902-450-1700, x278

0 Kudos

903 Views
mjbcswitzerland
Specialist V

Sara

I am assuming that the IDE is trying to access registers that can't be read, but I don't know why.

It sounds normal to me that it can't read the TPM registers after loading code since they are not yet clocked and I am assuming that you have been recently working with the TPM and so this is somehow an explanation for it starting.

What I can't imagine is that the TPMs have suddenly stopped working in the chip and that this is affecting the IDE behavior.

I would just roll back your version management system to a point before it started and import to KDS again, verify that the TPMs are working and then merge to your latest code again.

KDS is sometimes weird and one either needs to learn to live with its caveats or else move to a more efficient environment to avoid potential loss of time.

Regards

Mark

0 Kudos

903 Views
mjbcswitzerland
Specialist V

P.S. I thought I would take a quick look at why your project is not working but I couldn't get it to build due to various paths that couldn't be found.
However, looking at the code I think you are running the KL03 from the internal 48MHz clock and also using this to clock the TPM.
I have attached a FRDM-KL03Z binary (same clock configuration) that generates PWM signals on the LED connections (PTB10 and PTB13) (TPM0 and TPM1) at 1kHz (20% positive and 70.6% negative) and you can use your debugger to check the TPM (and clocks) setups to work out why yours isn't operating (I think you are essentially using the TPM as 50% PWM although maybe without an actual output). [It also has a command line interface on the OpenSDA VCOM at 115'200 which has also a memory debug interface - in the I/O menu "md 40038000 l 7" will display the first 7 registers in the first TPM module, etc.]
My code is below but it wasn't possible to check the low level code that it generates against yours without being able to run yours in a debugger since the KSDK macros being used are too cryptic to follow without investing quite a lot of time.

    PWM_INTERRUPT_SETUP pwm_setup;
    pwm_setup.int_type = PWM_INTERRUPT;
    pwm_setup.pwm_mode = (PWM_SYS_CLK | PWM_PRESCALER_16 | PWM_EDGE_ALIGNED); // clock PWM timer from the system clock with /16 pre-scaler
    pwm_setup.int_handler = 0;                                           // no user interrupt call-back on PWM cycle
    pwm_setup.pwm_reference = (_TIMER_0 | 1);                            // timer module 0, channel 1
    pwm_setup.pwm_frequency = PWM_FREQUENCY(1000, 16);                   // generate 1000Hz on PWM output
    pwm_setup.pwm_value   = _PWM_PERCENT(20, pwm_setup.pwm_frequency);   // 20% PWM (high/low)
    fnConfigureInterrupt((void *)&pwm_setup);                            // enter configuration for first PWM test

    pwm_setup.pwm_reference = (_TIMER_1 | 1);                            // timer module 1, channel 1
    pwm_setup.pwm_value  = _PWM_TENTH_PERCENT(706, pwm_setup.pwm_frequency); // 70.6% PWM (low/high) on different channel
    fnConfigureInterrupt((void *)&pwm_setup);                            // enter configuration for second PWM test

Regards

Mark

0 Kudos