[SOLVED] JLink script to set RTC in K60

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] JLink script to set RTC in K60

    Hi
    I'm a newcomer to the capabilities of Jlink, and am investigating the possibility of using Jlink (and/or associated utilities) to set the RTC within an NXP K60. On the surface of it, I think it ought to be possible using a (dynamically created/executed) Jlink script, but I'd appreciate a sanity check on this approach before I waste too much time on a possibly flawed approach.

    I am seeing some unexpected behaviour when attempting to read the related address ranges using commander (see attached) which may be indicative of my not having configured the device suitably beforehand, but again, any guidance would be most appreciated.

    David
    Images
    • Image 1.png

      27.34 kB, 881×461, viewed 32 times
  • Hi Alex

    Thank you for your response- I've figured out what I was doing wrong-which was that the perhiperal registers are only accessible once the corresponding SIM has its clock enabled- Like I said, I'm something of a a noob. Anyway, the extract below is a *.jlink file I generate dynamically and pass to jlink.exe, seems to be working fine...!


    r // Reset device
    w4 0x4004803C, 0x20000000 // SIM_SCGC6, RTC clock enable
    w4 0x4003D010, 0x00000001 // RTC_CR[SWR], assert software reset
    w4 0x4003D010, 0x00000000 // RTC_CR[SWR], take out of software reset
    w4 0x4003D010, 0x00000304 // RTC_CR, enable 32Khz clock, etc.
    w4 0x4003D000, 0X5F732C8B // RTC_TSR, Set (unix) time
    w4 0x4003D014, 0x00000010 // RTC_SR, Enable counter
    q // Exit JLink

    Thanks again
    David
  • Hi David,
    You have to start somewhere. :)

    Good to hear that you are up and running again.

    We will close this thread now.

    Best regards,
    Fabian
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/


    Or you can contact us via e-mail.