I'm using the evaluation board TWR-K65F180M, which is built on the Kinetis MCU MK65FN2M0VMI18.
I'm trying to configure FlexTimer 2 but I'm experiencing a problem: when I try to access the register FTM2_SC (which is the base peripheral address: 0x4003A000) the system hangs to the DefaultISR interrupt (which is located on the file Startup_MK65F18.S).
I'm using KDS 3.1.0, a Segger J-Link Debugger and the Project uses the Kinetis 1.3 SDK (specifically built for the specified processor K65) with Processor Expert; I obtain the same (bad) results with a bare-metal project.
It looks strange that I cannot access to a well-documented memory-mapped register; the situation is strange because i can access without any problems to FlexTimer 0 and 1 (peripheral base registers: 0x40038000 and 0x40039000).
I have already checked the chip documentation, the evaluation board documentation and the mask errata for the chip, without finding any solution to the problem.
I have attached the a simple project to simplify the diagnose of the issue.
Thanks in advance for your answers.
Original Attachment has been moved to: K65F180_FTM2_problem_project_example.zip
Sorry for my late reply!
You can try to enable the clock gate of FTM2 by using SIM_SCGC6[FTM2] instead of using SIM_SCGC3[FTM2].
The Processor Expert use SIM_SCGC3[FTM2] as default.
I am still waiting for the reply from our Processor Expert team, and I will give you the feedback when I get it.
Is it possibe that the library code forgets to enable the clock to the second FlexTimer module before use, or possibly it enables it in the wrong SIM register?
Eg. FlexTimer 1 clock is enabled by bit 0x02000000 in SIM_SCGC6 but FlexTimer 2 clock is 0x01000000 in SIM_SCGC3
HW timer guide: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF
I got the same result when using KDS3.2 with KSDK1.3 and Processor Expert.
I have create issue to our related team, and I will give you the feedback when I get it.