Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T3.6 - If we are going to use HSRUN, read serial number before #166

Closed

Conversation

KurtE
Copy link
Contributor

@KurtE KurtE commented Aug 18, 2016

If we are runnig at over 120mhz and turn on HSRUN mode, we can not read
in the USB serial number.

This is one attempt to see if we can read it in before we switch to
HSRUN mode.

My quick couple of test appeared to work, but may be cleaner ways

If we are runnig at over 120mhz and turn on HSRUN mode, we can not read
in the USB serial number.

This is one attempt to see if we can read it in before we switch to
HSRUN mode.

My quick couple of test appeared to work, but may be cleaner ways
@Defragster
Copy link
Contributor

I did this variation posted on the forum: https://forum.pjrc.com/threads/91-teensy-3-MAC-address?p=113762&viewfull=1#post113762

It uses the location of this - and uses the finding that if the area is read before HSRUN- the value is then present after HSRUN when the read fails. I don't know if that area may be volatile and something else may wipe it later?

@KurtE
Copy link
Contributor Author

KurtE commented Sep 6, 2016

As mentioned by Defragster, his single file (mk20dx128.c) change appears to work: Here is the differences from when I edited his in:

@@ -842,6 +842,13 @@ void ResetHandler(void)
    // if we need faster than the crystal, turn on the PLL
   #if defined(__MK66FX1M0__)
    #if F_CPU > 120000000

    // Code to get USB serial before entering HSRUN mode
    FTFL_FCCOB0 = 0x41;
    FTFL_FCCOB1 = 0x07;
    FTFL_FSTAT = FTFL_FSTAT_CCIF;
    while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF)) {}

    SMC_PMCTRL = SMC_PMCTRL_RUNM(3); // enter HSRUN mode
    while (SMC_PMSTAT != SMC_PMSTAT_HSRUN) ; // wait for HSRUN
    #endif

@Defragster
Copy link
Contributor

Pull 176 was taken and makes this obsolete

@PaulStoffregen
Copy link
Owner

fixed by #176

@KurtE KurtE deleted the Read-USB-Serial-before-HSRUN branch October 22, 2016 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants