FRDM-K64F PIT on different Rev boards

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

FRDM-K64F PIT on different Rev boards

Jump to solution
172 Views
ve3id
Contributor III

Hi,

I am experimenting with radio networking using six FRDM-K64F boards equipped with nrf23l01 transceivers.

I am splitting a second into ten time slots, the idea being that a transmission in slot 1 gets repeated in time slot 2, time slot 2 into time slot 3 etc for relaying.

So I am using PIT to generate interrupts at 100 ms periods, which I have checked on a scope.

On three boards, rev C,F, and F this is working fine and I am seeing the data on air being repeated.  However with the three rev F1 boards my transmit routine gets hung waiting for time slot 1 to come around. I am not getting the interrupt!

Does anybody know what changed between, say rev F and Rev F1 that would cause this behaviour?

Here is my init routine:

 

SIM->SCGC6 |= SIM_SCGC6_PIT_MASK; // Turn on clock to to the PIT PIT->MCR = 0x1; // Enable PIT timers

PIT->CHANNEL[0].LDVAL = 5999999; // Set reload value to 100mS

PIT->CHANNEL[0].TCTRL = 0x03; // Turn PIT timer 0 on, interrupts on

and in main:

NVIC_EnableIRQ(PIT0_IRQn); // Enable PI timer, ch 0 interrupt

and the ISR:

 

void PIT0_IRQHandler(void)

{

/* Clear interrupt flag */

PIT->CHANNEL[0].TFLG = PIT_TFLG_TIF_MASK;

NVIC_ClearPendingIRQ(PIT0_IRQn); // Clear pending PI timer, ch 0 interrupt

//scope_trigger();

time_slot +=1;

if (time_slot >10) time_slot=0;

__DSB(); // Add for ARM errata 838869, affects Cortex-M4

}

 

any help appreciated!

cheers

nigel

 

 

Labels (1)
0 Kudos
Reply
1 Solution
100 Views
carlos_o
NXP TechSupport
NXP TechSupport

Hi @ve3id 

The workaround mentioned with the errata is to put a read of the PIT_MCR register before writing it.

I use the PIT example of the SDK as base to test what you are doing in a FRDM board REV F1, I modified as following 

carlos_o_0-1790096350978.png

It works without issues. 

 

View solution in original post

5 Replies
135 Views
ve3id
Contributor III

Aha! Thanks for that. Yes I have that mask on all three chips. I'm surprised that your AI engine that I have found very useful so far did not bring that up! Is there a suggested work-around? A delay or nops maybe? And yes, the PIT->MCR = 0x1; should be on a separate line, the <cr><lf>  must have have slipped out during cut and paste.

0 Kudos
Reply
138 Views
carlos_o
NXP TechSupport
NXP TechSupport

Hi @ve3id 

Thank you for your post! 

Please review if the errata e7914 applies for your MCU: Kinetis_K_1N83J.pdf

I've tested it in FRDM-K64F REV F1 and it works, I used SDK 2.11.0 and MCUXpresso IDE 25.06.

Also, I notice that in the code you share the "PIT->MCR = 0x1;" is included as a comment in the enablement of the SCGC6, I only want to confirm if that is a typo in the post

 

0 Kudos
Reply
106 Views
ve3id
Contributor III
I've changed my init code to this and still have the same problem:
delay(10);
volatile uint32_t PIT_MCR_read = PIT->MCR; // to overcome problem in 1N83J mask set errata 2026-09-22 NWJ
PIT->MCR = 0x1; // Enable PIT timers
PIT->CHANNEL[0].LDVAL = 5999999; // Set reload value to 100mS
PIT->CHANNEL[0].TCTRL = 0x03; // Turn PIT timer 0 on, interrupts on

0 Kudos
Reply
105 Views
ve3id
Contributor III
I even changed the delay to 100 us and still no PIT action
0 Kudos
Reply
101 Views
carlos_o
NXP TechSupport
NXP TechSupport

Hi @ve3id 

The workaround mentioned with the errata is to put a read of the PIT_MCR register before writing it.

I use the PIT example of the SDK as base to test what you are doing in a FRDM board REV F1, I modified as following 

carlos_o_0-1790096350978.png

It works without issues. 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2415032%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFRDM-K64F%20PIT%20on%20different%20Rev%20boards%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2415032%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20experimenting%20with%20radio%20networking%20using%20six%20FRDM-K64F%20boards%20equipped%20with%20nrf23l01%20transceivers.%3C%2FP%3E%3CP%3EI%20am%20splitting%20a%20second%20into%20ten%20time%20slots%2C%20the%20idea%20being%20that%20a%20transmission%20in%20slot%201%20gets%20repeated%20in%20time%20slot%202%2C%20time%20slot%202%20into%20time%20slot%203%20etc%20for%20relaying.%3C%2FP%3E%3CP%3ESo%20I%20am%20using%20PIT%20to%20generate%20interrupts%20at%20100%20ms%20periods%2C%20which%20I%20have%20checked%20on%20a%20scope.%3C%2FP%3E%3CP%3EOn%20three%20boards%2C%20rev%20C%2CF%2C%20and%20F%20this%20is%20working%20fine%20and%20I%20am%20seeing%20the%20data%20on%20air%20being%20repeated.%26nbsp%3B%20However%20with%20the%20three%20rev%20F1%20boards%20my%20transmit%20routine%20gets%20hung%20waiting%20for%20time%20slot%201%20to%20come%20around.%20I%20am%20not%20getting%20the%20interrupt!%3C%2FP%3E%3CP%3EDoes%20anybody%20know%20what%20changed%20between%2C%20say%20rev%20F%20and%20Rev%20F1%20that%20would%20cause%20this%20behaviour%3F%3C%2FP%3E%3CP%3EHere%20is%20my%20init%20routine%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3ESIM-%26gt%3BSCGC6%20%7C%3D%20SIM_SCGC6_PIT_MASK%3B%20%2F%2F%20Turn%20on%20clock%20to%20to%20the%20PIT%20%3C%2FSPAN%3E%3CSPAN%3EPIT%3C%2FSPAN%3E%3CSPAN%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%3EMCR%3C%2FSPAN%3E%3CSPAN%3E%20%3D%200x1%3B%20%3C%2FSPAN%3E%3CSPAN%3E%2F%2F%20Enable%20PIT%20timers%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3EPIT%3C%2FSPAN%3E%3CSPAN%3E-%26gt%3B%3C%2FSPAN%3E%3CSPAN%3ECHANNEL%3C%2FSPAN%3E%3CSPAN%3E%5B0%5D.%3C%2FSPAN%3E%3CSPAN%3ELDVAL%3C%2FSPAN%3E%3CSPAN%3E%20%3D%205999999%3B%20%3C%2FSPAN%3E%3CSPAN%3E%2F%2F%20Set%20reload%20value%20to%20100mS%3C%2FSPAN%3E%3C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C%2FSPAN%3E%3CSPAN%3E%2F%2F%20Clear%20pending%20PI%20timer%2C%20%3C%2FSPAN%3E%3CSPAN%3Ech%3C%2FSPAN%3E%3CSPAN%3E%200%20interrupt%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2Fscope_trigger()%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Etime_slot%20%2B%3D1%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eif%3C%2FSPAN%3E%3CSPAN%3E%20(time_slot%20%26gt%3B10)%20time_slot%3D0%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E__DSB()%3B%20%3C%2FSPAN%3E%3CSPAN%3E%2F%2F%20Add%20for%20ARM%20%3C%2FSPAN%3E%3CSPAN%3Eerrata%3C%2FSPAN%3E%3CSPAN%3E%20838869%2C%20affects%20Cortex-M4%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3Eany%20help%20appreciated!%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Echeers%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Enigel%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2415032%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EKinetis%20K%20Series%20MCUs%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2415065%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FRDM-K64F%20PIT%20on%20different%20Rev%20boards%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2415065%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAha!%20Thanks%20for%20that.%20Yes%20I%20have%20that%20mask%20on%20all%20three%20chips.%20I'm%20surprised%20that%20your%20AI%20engine%20that%20I%20have%20found%20very%20useful%20so%20far%20did%20not%20bring%20that%20up!%20Is%20there%20a%20suggested%20work-around%3F%20A%20delay%20or%20nops%20maybe%3F%20And%20yes%2C%20the%26nbsp%3B%3CSPAN%3EPIT-%26gt%3BMCR%20%3D%200x1%3B%20should%20be%20on%20a%20separate%20line%2C%20the%20%3CCR%3E%3CLF%3E%26nbsp%3B%20must%20have%20have%20slipped%20out%20during%20cut%20and%20paste.%3C%2FLF%3E%3C%2FCR%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2415061%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FRDM-K64F%20PIT%20on%20different%20Rev%20boards%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2415061%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F460%22%20target%3D%22_blank%22%3E%40ve3id%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20your%20post!%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20review%20if%20the%20errata%20e7914%20applies%20for%20your%20MCU%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Ferrata%2FKinetis_K_1N83J.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EKinetis_K_1N83J.pdf%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EI've%20tested%20it%20in%20FRDM-K64F%20REV%20F1%20and%20it%20works%2C%20I%20used%20SDK%202.11.0%20and%20MCUXpresso%20IDE%2025.06.%3C%2FP%3E%0A%3CP%3EAlso%2C%20I%20notice%20that%20in%20the%20code%20you%20share%20the%20%22PIT-%26gt%3BMCR%20%3D%200x1%3B%22%20is%20included%20as%20a%20comment%20in%20the%20enablement%20of%20the%20SCGC6%2C%20I%20only%20want%20to%20confirm%20if%20that%20is%20a%20typo%20in%20the%20post%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2415416%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FRDM-K64F%20PIT%20on%20different%20Rev%20boards%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2415416%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F460%22%20target%3D%22_blank%22%3E%40ve3id%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20workaround%20mentioned%20with%20the%20errata%20is%20to%20put%20a%20read%20of%20the%20PIT_MCR%20register%20before%20writing%20it.%3C%2FP%3E%0A%3CP%3EI%20use%20the%20PIT%20example%20of%20the%20SDK%20as%20base%20to%20test%20what%20you%20are%20doing%20in%20a%20FRDM%20board%20REV%20F1%2C%20I%20modified%20as%20following%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22carlos_o_0-1790096350978.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22carlos_o_0-1790096350978.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22carlos_o_0-1790096350978.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22carlos_o_0-1790096350978.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F396703i8AFE49F296FDC5BD%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22carlos_o_0-1790096350978.png%22%20alt%3D%22carlos_o_0-1790096350978.png%22%20%2F%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Ecarlos_o_0-1790096350978.png%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Ecarlos_o_0-1790096350978.png%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Ecarlos_o_0-1790096350978.png%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIt%20works%20without%20issues.%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2415341%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FRDM-K64F%20PIT%20on%20different%20Rev%20boards%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2415341%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EI%20even%20changed%20the%20delay%20to%20100%20us%20and%20still%20no%20PIT%20action%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2415340%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20FRDM-K64F%20PIT%20on%20different%20Rev%20boards%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2415340%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EI've%20changed%20my%20init%20code%20to%20this%20and%20still%20have%20the%20same%20problem%3A%3CBR%20%2F%3Edelay(10)%3B%3CBR%20%2F%3Evolatile%20uint32_t%20PIT_MCR_read%20%3D%20PIT-%26gt%3BMCR%3B%20%2F%2F%20to%20overcome%20problem%20in%201N83J%20mask%20set%20errata%202026-09-22%20NWJ%3CBR%20%2F%3EPIT-%26gt%3BMCR%20%3D%200x1%3B%20%2F%2F%20Enable%20PIT%20timers%3CBR%20%2F%3EPIT-%26gt%3BCHANNEL%5B0%5D.LDVAL%20%3D%205999999%3B%20%2F%2F%20Set%20reload%20value%20to%20100mS%3CBR%20%2F%3EPIT-%26gt%3BCHANNEL%5B0%5D.TCTRL%20%3D%200x03%3B%20%2F%2F%20Turn%20PIT%20timer%200%20on%2C%20interrupts%20on%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E