Hi,
I'm having trouble with the PTB1 pin.. I cannot get it to output high.
Is there anything wrong with the following code? Is there anything "different" about PTB1? (I can't see anything from the manual)
#define PORTB_PCR1 (*(volatile uint32_t *)0x4004A004)
PORTB_PCR1 |= PORT_PCR_MUX(1);
#define GPIOB_PDDR (*(volatile uint32_t *)0x400FF054)
GPIOB_PDDR |= (1 << 1);
#define PORTB_PCR2 (*(volatile uint32_t *)0x4004A008)
// PORTB_PCR2 |= PORT_PCR_MUX(1);
//GPIOB_PDDR |= (1 << 2);
#define GPIOB_PSOR (*(volatile uint32_t *)0x400FF044)
// GPIOB_PSOR |= (1 << 2);
GPIOB_PSOR |= (1 << 1);
Included is some commented out code that sets PB2, which works. "works" = measure the pin with a multimeter and get ~3v. However I never get any output from PBT1.
I'm testing the MCU pin leg directly, so I assume it's not related to the rest of the PCB design.
This is driving me crazy, any help appreciated!
Joey
Solved! Go to Solution.
Joey
I would suggest looking into
PORTB_PCR1 |= PORT_PCR_MUX(1);
This would be safer if made
PORTB_PCR1 = ((
PORTB_PCR1 & ~0x700) |
PORT_PCR_MUX(1));
You code "assumes" that the MUX setting is 0 at reset but who knows what it really is? especially as the KL27's internal boot loader may be messing with its I2C setting at this pin.....
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
KL27: http://www.utasker.com/kinetis/FRDM-KL27Z.html / http://www.utasker.com/kinetis/Capuccino-KL27/Capuccino-KL27.html
For the complete "out-of-the-box" Kinetis experience and faster time to market
Joey
I would suggest looking into
PORTB_PCR1 |= PORT_PCR_MUX(1);
This would be safer if made
PORTB_PCR1 = ((
PORTB_PCR1 & ~0x700) |
PORT_PCR_MUX(1));
You code "assumes" that the MUX setting is 0 at reset but who knows what it really is? especially as the KL27's internal boot loader may be messing with its I2C setting at this pin.....
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
KL27: http://www.utasker.com/kinetis/FRDM-KL27Z.html / http://www.utasker.com/kinetis/Capuccino-KL27/Capuccino-KL27.html
For the complete "out-of-the-box" Kinetis experience and faster time to market
Correct again Mark!
I think I need you on a hotline for all my kinetis issues :smileywink: