KEA8 Pull-up Disable

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

KEA8 Pull-up Disable

1,249 Views
Robinwithu
Senior Contributor I

Hello All,

I am having issue with TRK-KEA8 BOARD Pull-up Disable

#define PORT_PTA0    0

    #define PORT_PTA1    1

    #define PORT_PTA2    2

    #define PORT_PTA3    3

    #define PORT_PTA4    4

    #define PORT_PTA5    5

    #define PORT_PTA6    6

    #define PORT_PTA7    7

    #define PORT_PTB0    8

    #define PORT_PTB1    9

    #define PORT_PTB2    10

    #define PORT_PTB3    11

    #define PORT_PTB4    12

    #define PORT_PTB5    13

    #define PORT_PTB6    14

    #define PORT_PTB7    15

void main(void)

   

    {

       

         asm("CPSID i");                                                                        // Disable Interrupt

             ICS_C1|=ICS_C1_IRCLKEN_MASK;                                                             /* Enable the internal reference clock*/

             ICS_C3= 0x90;                                                                            /* Reference clock frequency = 39.0625 KHz*/       

             while(!(ICS_S & ICS_S_LOCK_MASK));                                                       /* Wait for PLL lock, now running at 40 MHz (1024 * 39.0625Khz) */       

             ICS_C2|=ICS_C2_BDIV(1)  ;                                                                 /*BDIV=2, Bus clock = 20 MHz*/

             ICS_S |= ICS_S_LOCK_MASK ;                                                                 /* Clear Loss of lock sticky bit */   

        

            

            

             WDOG_CNT      = 0x20C5;                                                                     // write the 1st unlock word

             WDOG_CNT      = 0x28D9;                                                                     // write the 2nd unlock word

              

             WDOG_TOVALL  = 10;                                                                         // Write New Word in WDT : 10 x  (1 / 1000) = 10 msec but cause of tolerance it's 16msec (Appx. +25 /-35 %)

             WDOG_TOVALH  = 0;

                

             WDOG_CS2      = 0x01;                                                                        // Select clock 1Khz ; to select 32 Khz clock we need to Enable in ICS_C1 register internal reference clock enable bit ICS_C1[IRCLKEN]

             WDOG_CS1      = 0x80;                                                                        // Enable WDT : Feed the Dog : Activate the Dog

        

            

        SIM_SOPT = 0xC;                                                                            // PTB4 Default to NMI function: PTB4 to Normal GPIO

        

        GPIOA_PDDR = 0xF7F2;                                                                      // Define PortA (A1-A3) all Pin As Output  ; one is Output and Zero is Input 

                                                                                                // After POR : Power on Reset The Port Pins are in High Impedance State        

        GPIOA_PIDR &= ~1 ;                                                                    // configure PORTA0 pin as GPIO input, must clear PIDR bit

        GPIOA_PIDR &= ~2048 ;                                                                    // configure PORTB3 pin as GPIO input, must clear PIDR bit

                                                                                            // 0 and 11  are Register Bit to clear A0 and B3 refer GPIO Register Bit Assignment Datasheet Table 33-21

        GPIOA_PDDR |= 0 << PORT_PTA0 ;                                                                    // direction is INPUT , PORTA0

        GPIOA_PDDR |= 0 << PORT_PTB3;       

       

       

        GPIOA_PDOR =  0x0000;                                                                     // Initialise the PORTA, PORTB

       

      

       PORT_PUEL  &= 0 << PORT_PTA0 ;   

       PORT_PUEL  |= 1 << PORT_PTA2 ;                                                                        // Pull Enable on A0(Default Pull-up ENable Cause of programming Pin),  A2 and A3  0X0000D

       PORT_PUEL  |= 1 << PORT_PTA3 ;   

      

       PORT_PUEL  & = 0 << PORT_PTA2 ;                                                       // Disable pull-up

       PORT_PUEL   &= 0 << PORT_PTA3  ;

       

   

}

Problem:

It's a part of my code , i am trying to disable the Individual Pull-Up , as i my case first enabled Pull up on  PORTA2 and PORTA3 and then Disabled (just for debugging but in real code Pull-up disable is after 20msec) , it disable both the Pull-Up  PORT bits PORTA2 and PORTA3 both at the same time i.e. by first  instruction of pull-up disable PORT_PUEL  & = 0 << PORT_PTA2 . it's not disabling the individual Bits , instant of that whole Port Pull-up? why?

Info : Both pins are Open Drain pins and having SDA/SCL Structure (Please refer page number 142 OF KEA8  Sub Family Reference manual)

Note: I test it on LED and also seen on Debugging register getting same result as i mentioned above.

Labels (1)
Tags (1)
0 Kudos
5 Replies

962 Views
mjbcswitzerland
Specialist V

Robin

PORT_PUEL   &= 0 << PORT_PTA3  ;

is the same as

PORT_PUEL   &= 0;

is the same as

PORT_PUEL  = 0;

therefore it disables all pull-ups

I think you wanted to write

PORT_PUEL   &= ~(1 << PORT_PTA3) ;

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support / µTasker FRDM-KE02Z40M support / µTasker FRDM-KE06Z support

For the complete "out-of-the-box" Kinetis experience and faster time to market

962 Views
Robinwithu
Senior Contributor I

Hello Mark,

I need Assembly Instructions set to know the bus cycles for each Assembly instructions  for KEA8 controller , please can you tell me where i will find ? It's not given in datasheet :smileysad:

Thanks in Advance.

MFG

Robin

0 Kudos

962 Views
mjbcswitzerland
Specialist V

Robin

For information about the core you need to use ARM documentation.

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0432c/CHDCICDF.html

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support / µTasker FRDM-KE02Z40M support / µTasker FRDM-KE06Z support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos

962 Views
Robinwithu
Senior Contributor I

Thank you Mark :smileyhappy:

Have a nice Day !!!

0 Kudos

962 Views
Robinwithu
Senior Contributor I

Thanks Mark,

Mfg

Robin

0 Kudos