Configuring interrupt

24 posts / 0 new
Last post
goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Configuring interrupt

Hello Team,

I am trying to integrate a gyro sensor with DA1586 and configure interrupt for the sensor. For basic I2C communication I used P0_2 and P0_3 pins taking i2c_eeprom as a reference and got the desired output .Now for configuring interrupt can I have any reference example and what are the hardware pins to be connected for enabling interrupt?

Thanks,
Goutham.N

Device: 
PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

Please have a look into the DA14585 IoT Multi Sensor Development Kit. You could find it into the reference design tab of DA14585 from our support page or for your convenience follow the link below=:

https://support.dialog-semiconductor.com/connectivity/product/da14585?qt-product_restricted_=5&qt-view__reference_designs__block_1=5#qt-view__reference_designs__block_1

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Hello Team,

Hello Team,

Actually the sensor is having interrupt pins which have to be connnected to DA14586 microcontroller . So which pins of the microcontroller should I use to connect the interrupt pins of the sensor and configure them in the program?

Thanks,
Goutham.

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

In order to configure a GPIO as an interrupt you should use the GPIO_EnableIRQ() API. Could you please clarify which your problem is? You should not select any specific GPIO. I think that the SW Example: Reading out an I2C accelerometer and sending notification data example from our support portal might help you. Please follow the steps described into the SW Example: DA1458x Example Setup in order to run the example.

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Actually I'm interfacing a

Actually I'm interfacing a interrupt based sensor with DA1586.Usually for I2c communication between the sensor and the microcontroller I used the P0_2 and P0_3 pins.I am getting the physical information from the sensor.Now to configure interrupt there are different interrupt pins for accelerometer and gyroscope which are to be connected to the microcontroller.So my issue is to which pins should i connect and configure them to enable the interrupt??

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
And which pins in the

And which pins in the development kit are used for configuring interrupt?

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

The GPIOs are fully programmable, so you can choose any of them and configure it as interrupt pin. Please check the Table 1: Pin Description of the DA14586 datasheet.  Could you please clarify what you are trying to accomplish? Also, I would suggest you to have a look at the 10.3.6 Function Reference: Interrupt Handling Functions section of UM-B-079 DA14585 & DA14586 Software Platform Reference (SDK 6.0.8) user manual, in order to find all the available of APIs.

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Hello Team,

Hello Team,

Actually I am performing a i2c interface between a gyro sensor and DA14586 MCU. I am receiving sensor values in the terminal after programming taking i2c_eeprom code as a reference. For i2c I have used pins P0_2 and P0_3 of DA14586 connecting them to the sensors SCL and SDA pins respectively.The sensor which I am using is a an interrupt based sensor.To configure the Interrupt I have to connect the interrupt pin of the sensor to the dialog MCU. So to which pin I have to connect?? and how to configure interrupt ?.Should I use the GPIO_enableIRQ API , that's it?
Is there any reference for this?
Thanks for the support.

Thanks,
Goutham.N

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Additional Query

Additional Query

The main application is when the sensor crosses a set threshold it should generate an interrupt.For this type of application what is the API I should follow?

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
goutham,

Hi goutham,

You are able to connect the interrupt pin of the sensor to everyone GPIO of the DA14586. You should configure the GPIO as input and use the GPIO_enableIRQ() in order to get the interrupt from the side of DA14586. After that you can register a callback functions since you get the interrupt from the sensor by using the GPIO_RegisterCallback() API.

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Hello team,

Hello team,

Actually I want to activate the sensor and keep the micro controller in sleep mode and when an interrupt is generated based on the set threshold then the micro controller should become active and notify if interrupt is generated , such that I want to save the micro controller power.How to accomplish this type of task?

Thanks,
Goutham

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

>> activate the sensor and keep the micro controller in sleep mode

Could you please clarify it? The DA14586 will be in sleep mode and the sensor will generate an interrupt in orde to wake the chip up? Is that correct? Otherwise, please

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Yes exactly Whenever there is

Yes exactly Whenever there is an interrupt event generated in the sensor it should wake up the microcontroller. I want to read the sensor data then keep the microcontroller in sleep mode and when an interrupt is generated then it should wake up the microcontroller rather than continous monitoring by microcontroller.

Thanks,
Goutham

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Additional Queries

Additional Queries

1)How to implement Callback function after the interrupt is generated.Only if we use the GPIO Callback register API?
2)What is the flow to be implemented for generating interrupt when threshold is crossed.?
3) Enable IRQ and Callback interrupt that's it?

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

I would highly recommend you to have a look at the ble_app_sleepmode of the SDK. If the device is configured in any of sleep mode you could wake it up through the wake-up controller.  Also, it would be very helpful to read the 7.6 Pillar 5 (Sleep Mode) of the UM-B-080 user manual in order to understand how you can wake the device up. In your case the interrupt will be generated from the sensor and not from the button.

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Hello Team,

Hello Team,

I am facing problem in enabling the interrupt pin to which GPIO is configured.

To configure GPIO pin as a interrupt pin I have done
1) In user_periph_setup.h ->defining port and pin using macros
2)In user_periph_setup.c -> Configuring GPIO using GPIO ConfigurePin
And passing parameters into GPIO_EnableIRQ()
Is the above procedure correct?

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
 

 

Hi goutham,

Please check the steps below demonstrating how to use the IRQ and detecting an interrupt from a button connected to pin1_1. Be aware that with the following code snippet, you will not be able to wake up from the sleep. In case you would like this functionality please let me know or check the ble_app_sleepmode example.

  1. user_periph_setup.h

    #define GPIO_BUTTON_PORT  GPIO_PORT_1

    #define GPIO_BUTTON_PIN   GPIO_PIN_1

 

  1. user_periph_setup.c

void GPIO_reservations(void)

{

RESERVE_GPIO(PUSH_BUTTON, GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, PID_GPIO);

}

 

void set_pad_functions(void)        // set gpio port function mode

{

GPIO_ConfigurePin(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, INPUT_PULLUP, PID_GPIO, false);

}

 

  1. In your application code

GPIO_RegisterCallback(GPIO0_IRQn, your_callback_function);

GPIO_EnableIRQ(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN,GPIO0_IRQn,true,false,0)

 

If low_input in GPIO_EnableIRQ() is TRUE, it generates an IRQ if the input is low. If the input is low, the your_callback_function  will be triggered. Also you should include the gpio.h library.

Regards, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Hi

Hi

Thanks for the GPIO configuration procedure .I want the microcontroller to wake up from sleep when an interrupt from the sensor is triggered.How to accomplish this?

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Hi

Hi

Thanks for the GPIO configuration procedure .I want the microcontroller to wake up from sleep when an interrupt from the sensor is triggered.How to accomplish this?

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

As I had mentioned in a previous post, if you would like to wake up from any type of sleep mode, you should use the wake-up controller.  The code snippet that I have provided you will not be working if your device enters the sleep mode. Could you please indication what you want to accomplish? The same functionality with the ble_app_sleepmode example of the SDK? Did you check this example? You could find the appropriate steps to use the wake-up controller.

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Hi

Hi

Actually I am interfacing a gyro interrupt based sensor with DA14586 and I have done the i2c interfacing and got the sensor values output.Whenever it crosses a certain threshold it should notify.To be clear I want to implement the one which I have mentioned in the attached picture.

Thanks,
Goutham.N

PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

Apologies but I am little bit confused. In which attached picture are referring to? Could you please attach it?

Thanks, PM_Dialog

goutham
Offline
Last seen: 1 month 2 weeks ago
Joined: 2017-08-10 12:34
Apologies for not attaching

Apologies for not attaching.Here is the image.Please extract the zip file.

Thanks,
Goutham.N

Attachment: 
PM_Dialog
Offline
Last seen: 1 week 2 days ago
Staff
Joined: 2018-02-08 11:03
Hi goutham,

Hi goutham,

Please check the IoT project from the IoT Multisensor kit reference design of DA14585. You will find this reference design in the support portal of DA14585, and the project I am talking about is locates under DA14585_IOT_MULTI_SENSOR_DK_v6.160.2\DA14585_MULTI_SENSOR_DK\v6.160.2\projects\target_apps\iot\iot_585\Keil_5 path. Also refer to paragraph 5.3.3 Advertise of the
DA14585 IoT Multi Sensor Development Kit : UM_B_096 user manual. The device will start advertising by default. The advertisement time period is determined by the value set on ADV_TIME_OUT. When the timer expires, user_app_on_adv_undirect_complete() is executed to terminate advertising. If sleep mode is set to ARCH_EXT_SLEEP_ON, the system will attempt to power off and enable wake on motion interrupt. If the ALWAYS_ADVERTISE is undefined, the motion sensor is excluded from this project and therefore there are no means to wake the processor. The accelerometer for this purpose is configured for low power operation with the “anymotion” interrupt function set. The processor is allowed to go to Extended Sleep mode and wakes up only when it receives an interrupt from the accelerometer. Then the interrupt handler wkup_intr_non_connected_cb() is executed, which initiates advertising. Please follow the wom_acc_setup() which is called inside user_app_on_adv_undirect_complete() function in order to understand how to wake up via a motion interrupt

Thanks, PM_Dialog