In KL27 why does MTB_POSITION not read what is written?

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

In KL27 why does MTB_POSITION not read what is written?

Jump to solution
768 Views
bobpaddock
Senior Contributor III

I am trying to use the Micro Trace Buffer in the KL27.

If I do:


MTB_MASTER = 0UL; /* Disable MTB */


MTB_POSITION = MTB_BASE; /* Set position to start of RAM */

Reading MTB_POSITION back returns 0x6000 rather than the start of RAM.
MTB_BASE does read as the start of RAM, as expected.

Per the MKL27 datasheet 43.3.1.1 MTB_POSITION should read what is written,

except for the bottom three bits.

Tracing seems to work, other than this odd reading of MTB_POSITION.


What is going on here?

0 Kudos
Reply
1 Solution
659 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Bob,

I guess your KL27 has 32k SRAM.  The value written in MTB_POSITION will be AND with 0x7FF8. Please see 43.3.1.1. In MCUXpresso or other IDE, you can observe this by written 0x1ffff000 to MTB_POSITION .

Regards,

Jing

View solution in original post

0 Kudos
Reply
3 Replies
660 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Bob,

I guess your KL27 has 32k SRAM.  The value written in MTB_POSITION will be AND with 0x7FF8. Please see 43.3.1.1. In MCUXpresso or other IDE, you can observe this by written 0x1ffff000 to MTB_POSITION .

Regards,

Jing

0 Kudos
Reply
659 Views
bobpaddock
Senior Contributor III

Thank you, now the cryptic note "...the active bits in this field are POSITION[14:3] == POSITION[POINTER[11:0]]" makes sense.

Should not the 32-bit field diagram reflect that the top bits are always zero, to match the text?

0 Kudos
Reply
659 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Bob,

yes. In fact, this chapter copies from ARM.

https://static.docs.arm.com/ddi0486/b/DDI0486B_coresight_mtb_m0p_r0p1_trm.pdf

Regards,

Jing

0 Kudos
Reply