Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Direct register access using address

  1. #1

    Direct register access using address

    On the Teensy 3.6 the register CMT_PPS has the address 0x4006200A according to the datasheet. How can I access the CMT_PPS register using this address?

  2. #2
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    430
    I imagine this page may help: http://infocenter.arm.com/help/index...qs/ka3750.html
    Seems to be just a matter of creating a pointer variable to that register.

  3. #3
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,240
    Quote Originally Posted by ossi View Post
    On the Teensy 3.6 the register CMT_PPS has the address 0x4006200A according to the datasheet. How can I access the CMT_PPS register using this address?
    for T3* boards most register symbols are defined in hardware/teensy/avr/cores/teensy3/kinetis.h
    Code:
    #define CMT_PPS			(*(volatile uint8_t  *)0x4006200A) // CMT Primary Prescaler Register
    so all you have to do is reference it in your sketch, e.g. Serial.println(CMT_PPS,HEX);

    For Teensy 4, see hardware/teensy/avr/cores/teensy4/imxrt.h

  4. #4
    @vjmuzik: Your link was of great help! I did not read/write the registers with the right size (32,16,8 bit). Now it works.
    @manitou: I know that I can use the names for the periperals, but I wanted to access them without using names. Thanks for the hints to the place where the constants are defined.

    Thanks to all those people at this forum helping a beginner!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •