Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 10 months ago.
High Drive mode in FRDMKL25Z
How to use high drive mode in FRDMKL25Z. The datasheet says that the register PTx_PCRn has to be configured to obtain the high drive capability. Please help me out with configuring the registers.
1 Answer
10 years, 10 months ago.
Dear Santosh-san,
I tried to find PORTx_PCRn in mbed source, but could not find one.
So, in the Reference Manual of KL25Z, 11.5 memory map and register definition
there is a list of address(es) of these ports.
For example if we use D4, which is PTD4 of KL25Z,
the register would be PORTD_PCR4 which is 4004_C010 according to the list.
The drive strength bit is DSE which is bit 6 of PORTx_PCRn, so it is 0x40
So if you say
#include "mbed.h"
DigitalOut dout(PTD4) ;
int main() {
uint32_t *PORTD_PCR4 = (uint32_t*)0x4004C010 ;
*PORTD_PCR4 &= ~0x40 ; /* low drive strength */
*PORTD_PCR4 |= 0x40 ; /* high drive strength */
/* do whatever you like to */
}
Please note that this is what I "think" work, but I have not tested it.
moto
All those registers are included in the CMSIS files, no need to define the address manually. Here is the relevant file: http://developer.mbed.org/users/mbed_official/code/mbed-src/file/e03396e14338/targets/cmsis/TARGET_Freescale/TARGET_KLXX/TARGET_KL25Z/MKL25Z4.h
From there it should be addressable as:
PORTD->PCR[4]
Wow, that file is very helpful!
Then we can say
PORTD->PCR[4] |= PORT_PCR_DSE_MASK ;
moto
posted by 03 Feb 2015