This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello friends,
I have the following problem, and I hope you can me help solve. I am trying to read the status of a pin in the MSP432P401R, after he made a data transmission (TX), the CS pin goes High, and when all data finish he change the state pin to Low. In the debug mode, a follow the state of pin, but I dont see any change. I wrote the following code the goal it has when the function are called one interruption is required.
int main(void){ DRDY_Work(); while(1){ while(!finish_flag); MAP_GPIO_disableInterrupt( GPIO_PORT_P4, GPIO_PIN4); finish_flag=0; MAP_GPIO_clearInterruptFlag( GPIO_PORT_P4, GPIO_PIN4); MAP_GPIO_enableInterrupt( GPIO_PORT_P4, GPIO_PIN4); } } } void DRDY_Work(void){ MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P4, GPIO_PIN4); GPIO_interruptEdgeSelect(GPIO_PORT_P4,GPIO_PIN4, GPIO_HIGH_TO_LOW_TRANSITION); MAP_GPIO_clearInterruptFlag(GPIO_PORT_P4, GPIO_PIN4); MAP_GPIO_enableInterrupt(GPIO_PORT_P4, GPIO_PIN4); MAP_Interrupt_enableInterrupt(INT_PORT4); } void PORT4_IRQHandler(void){ uint32_t status; status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P4); MAP_GPIO_clearInterruptFlag(GPIO_PORT_P4, status); /* Toggling the output on the LED */ if(status & GPIO_PIN4){ finish_flag = 1; } }
Thanks in advance
Hi Biza,
Can you provide more detail on what you're seeing? Is PORT4_IRQHandler() ever entered, and if so, what is the value of "status"?
Thanks,
Urica Wang
Hello Urica Wang,
Thank you for your support,
It is the first time, I use the driverlib, and I have doubts that I'm doing something wrong
I can't get into the interrupt, so I can't tell you what the result of the status variable is.
Thanks
Hi Biza,
Thanks for clarifying. I would make sure to call MAP_Interrupt_enableMaster() after MAP_Interrupt_enableInterrupt() in DRDY_work(). This allows the processor to respond to interrupts.
Thanks,
Urica Wang
Hi Biza,
I don't see MAP_Interrupt_enableMaster() in the code above. Do you have a newer version of the code to show me?
Thanks,
Urica Wang
Yes Urica you are right ,
But now I have put the MAP_Interrupt_enableMaster() in the main after the function and before the while loop
Hi Biza,
Can you provide more details on what you're seeing/the behavior of the code? Are you now able to enter the interrupt, and if so, what is the value of "status"?
Thanks,
Urica Wang
I cant not enter in the interrupt, in doubt if the problem does not come from another situation, because for there to be a transition of states, low/high on the pins must be triggered by something, something that is not happening
I cant not enter in the interrupt, in doubt if the problem does not come from another situation, because for there to be a transition of states, low/high on the pins must be triggered by something, something that is not happening
Hi Biza,
I have tried the code you have linked above and was able to enter the ISR with a few changes:
1. Halted the watchdog
2. Commented out the closing brace on line 15 due to compile errors
3. Changed code to use P1.1, which has a switch connected to it on the MSP432P401R launchpad. Whenever the switch is pressed, the ISR is entered.
Here is the code with the changes for your reference.
/* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> uint8_t finish_flag = 0; void DRDY_Work(void); int main(void){ MAP_WDT_A_holdTimer(); // U. Wang. Added this line. DRDY_Work(); MAP_Interrupt_enableMaster(); while(1){ while(!finish_flag); MAP_GPIO_disableInterrupt( GPIO_PORT_P1, GPIO_PIN1); finish_flag=0; MAP_GPIO_clearInterruptFlag( GPIO_PORT_P1, GPIO_PIN1); MAP_GPIO_enableInterrupt( GPIO_PORT_P1, GPIO_PIN1); //} // U. Wang. Removed this line. } } void DRDY_Work(void){ MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1); GPIO_interruptEdgeSelect(GPIO_PORT_P1,GPIO_PIN1, GPIO_HIGH_TO_LOW_TRANSITION); MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1); MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1); MAP_Interrupt_enableInterrupt(INT_PORT1); } // When the switch (P1.1) is pressed, this ISR is entered void PORT1_IRQHandler(void){ uint32_t status; status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1); MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status); if(status & GPIO_PIN1){ finish_flag = 1; } }
Using an oscilloscope or logic analyzer, can you verify whether a state transition is occurring on P4.4?
Thanks,
Urica Wang