AnsweredAssumed Answered

BF706 GPIO PINT_INV_SET Use Question

Question asked by Scrappy on Feb 17, 2017
Latest reply on Jul 18, 2017 by Jithul_Janardhanan

Hello,


I have some questions on using BF706 GPIO operations.

Following is the question about the BF706 GPIO PINT_INV_SET register.


Platform Model : BF706 EZ-KIT-MINI

Requirement : When the PB1 (Button) is pressed, the state of LED0 will be changed.


Problem :

According to the description in the file “BF70x_BlackfinProcessorHardwareReference” downloaded on the ADI website, setting PINT_INV_SET should be able to change the Interrupt trigger mode. And the following code should set the trigger mode to Low Level Trigger.


Then I set a breakpoint before this line “*pREG_PORTC_DATA_TGL | = ADI_GPIO_PIN_3” and pressed the button, the program did not enter this line. But if I released the Button , the program has entered.


So I don’t know if this is the wrong way to set, or my understanding of PINT_INV_SET is not correct?

Please help to advise this question.

Yours sincerely!

 


Below is the code I used for testing.

 

int main(void)

{

   adi_initComponents();

   GPIO_SET();

   GPIO_INTERRUPT_SET();

   while(1){}

}

 

void GPIO_SET(void)

{

   /*LED0*/

   *pREG_PORTC_FER_CLR |= ADI_GPIO_PIN_3;

   *pREG_PORTC_DATA_SET |= ADI_GPIO_PIN_3;

   *pREG_PORTC_DIR_SET |= ADI_GPIO_PIN_3;

   /*PB1*/

   *pREG_PORTC_FER_CLR |= ADI_GPIO_PIN_2;

   *pREG_PINT1_INV_SET |= ADI_GPIO_PIN_2;

   *pREG_PORTC_DIR_CLR = ADI_GPIO_PIN_2;

   *pREG_PORTC_INEN_SET |= ADI_GPIO_PIN_2;

}

 

void GPIO_INTERRUPT_SET(void)

{

   *pREG_PINT1_ASSIGN |= ADI_GPIO_PIN_2;

   *pREG_PINT1_MSK_SET |= ADI_GPIO_PIN_2;

   *pREG_PINT1_EDGE_CLR |= ADI_GPIO_PIN_2;

   adi_int_InstallHandler(INTR_PINT1_BLOCK, GPIO_ISR1, NULL, true);

}

 

void GPIO_ISR1(uint32_t iid, void* handlerArg)

{

   if(*pREG_PORTC_DATA & ADI_GPIO_PIN_2)

   {

      *pREG_PORTC_DATA_TGL |= ADI_GPIO_PIN_3;

   }

}

Attachments

Outcomes