Signal manager

groups at chichak.ca groups at chichak.ca
Fri Aug 19 14:15:56 UTC 2016


Strangely, I got my first EXTI interrupt working two days ago.

Mine was on pin PB14 and goes low when active. Cube generated a bunch of code:

first, a file called mxconstants.h with:
#define SOL2ST_Pin GPIO_PIN_14
#define SOL2ST_GPIO_Port GPIOB

and in gpio.c:
  /*Configure GPIO pin : PtPin */
  GPIO_InitStruct.Pin = SOL2ST_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(SOL2ST_GPIO_Port, &GPIO_InitStruct);

in stm32f4xx_it.c:
/**
* @brief This function handles EXTI line[15:10] interrupts.
*/
void EXTI15_10_IRQHandler(void)
{
  /* USER CODE BEGIN EXTI15_10_IRQn 0 */

  /* USER CODE END EXTI15_10_IRQn 0 */
  HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_14);
  /* USER CODE BEGIN EXTI15_10_IRQn 1 */

  /* USER CODE END EXTI15_10_IRQn 1 */
}




For my code, I hook it using:

	status = rtems_interrupt_handler_install(EXTI15_10_IRQn, "EXTI", RTEMS_INTERRUPT_UNIQUE,
			(rtems_interrupt_handler) EXTI15_10_IRQHandler, NULL);
	if (status != RTEMS_SUCCESSFUL) {
		printk(“EXTI interrupt install bombed with %d\n”, status);
	}


And catch the interrupt using:

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
 	if (GPIO_Pin == SOL2ST_Pin) {
	}
}


I hope this helps.

Andrei from The Great White North
(embedded.fm/blog <http://embedded.fm/blog>)

> On 2016-August-19, at 07:52, Ярослав Лещинский <midniwalker at gmail.com <mailto:midniwalker at gmail.com>> wrote:
> 
> Hi, everyone!
> 
> My battle with stm32 interrupts continues. Three month ago Andrei from The Great White North gave me some code advise:
> 
> In my code I use interrupts for DMA with ADCs, and CAN using the HAL interrupt handler callback structure. 
> In this case, DMA2_Stream2_IRQHandler calls HAL_DMA_IRQHandler in stm32f4xx_hal_dma.c which figures what caused the interrupt and calls the appropriate callback.
> In my ADC code I use this:
> 	rtems_status_code status;
> 	const char ADC1handlerName[] = "AD1r";
> 	status = rtems_interrupt_handler_install((rtems_vector_number) DMA2_Stream2_IRQn,
> 			ADC2handlerName, RTEMS_INTERRUPT_UNIQUE,
> 			(rtems_interrupt_handler) DMA2_Stream2_IRQHandler, NULL);
> 	if (status != RTEMS_SUCCESSFUL) {
> 		printk("interrupt handler install 2 failed with %d\n", status);
> 	}
> 
> Later, I have the interrupt callbacks:
> void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
> 	rtems_status_code status;
> 	status = rtems_event_send(ADCTaskId, RTEMS_EVENT_0);
> 	if (status != RTEMS_SUCCESSFUL) {
> 		printk("complete callback failed with %d", status);
> 	}
> }
> void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc) {
> 	rtems_status_code status;
> 	status = rtems_event_send(ADCTaskId, RTEMS_EVENT_1);
> 	if (status != RTEMS_SUCCESSFUL) {
> 		printk("half complete callback failed with %d", status);
> 	}
> }
> 
> 
> i was trying the same but only for EXTI driver and no result. I have such code:
> http://pastebin.com/BZBNPRbg <http://pastebin.com/BZBNPRbg>
> 
> After flashing, i received in console string "53", when i pushed the button - all stopped, only reset can brought him back to life.
> 
> In C user guide i didn't find any references to  rtems_interrupt_handler_install, some info was about rtems_interrupt_catch, but when i try to use this, i received "undefined reference". 
> 
> Maybe, someone can help me with that problem?
> 
> Thanks.
> 
> P.S. Sorry for my english.
> 
> 
> 2016-05-17 8:40 GMT+03:00 Ярослав Лещинский <midniwalker at gmail.com <mailto:midniwalker at gmail.com>>:
> Andrei, thanks!
> 
> 17 мая 2016 г. 8:31 пользователь <groups at chichak.ca <mailto:groups at chichak.ca>> написал:
> 
> 
>> On 2016-May-16, at 11:10, Ярослав Лещинский <midniwalker at gmail.com <mailto:midniwalker at gmail.com>> wrote:
>> 
>> Hello. I'm try to use rtems with my stm board(stm32f4xx). And for now i have one problem: it's about ISR. The thing is, i have my own drivers, which uses isr(exti driver, uart and etc). I read rtems c-user manual properly,  but still can't understand clearly, how i can bring control to rtems signal manager via ASR. I'll be appreciated, if someone can give some advise.
>> 
>> Yaroslavl.
> 
> In my code I use interrupts for DMA with ADCs, and CAN using the HAL interrupt handler callback structure. 
> 
> In this case, DMA2_Stream2_IRQHandler calls HAL_DMA_IRQHandler in stm32f4xx_hal_dma.c which figures what caused the interrupt and calls the appropriate callback.
> 
> In my ADC code I use this:
> 
> 	rtems_status_code status;
> 	const char ADC1handlerName[] = "AD1r";
> 	status = rtems_interrupt_handler_install((rtems_vector_number) DMA2_Stream2_IRQn,
> 			ADC2handlerName, RTEMS_INTERRUPT_UNIQUE,
> 			(rtems_interrupt_handler) DMA2_Stream2_IRQHandler, NULL);
> 	if (status != RTEMS_SUCCESSFUL) {
> 		printk("interrupt handler install 2 failed with %d\n", status);
> 	}
> 
> 
> Later, I have the interrupt callbacks:
> 
> void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
> 
> 	rtems_status_code status;
> 	status = rtems_event_send(ADCTaskId, RTEMS_EVENT_0);
> 	if (status != RTEMS_SUCCESSFUL) {
> 		printk("complete callback failed with %d", status);
> 	}
> }
> 
> void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc) {
> 
> 	rtems_status_code status;
> 	status = rtems_event_send(ADCTaskId, RTEMS_EVENT_1);
> 	if (status != RTEMS_SUCCESSFUL) {
> 		printk("half complete callback failed with %d", status);
> 	}
> }
> 
> 
> In my CAN code I use:
> 
> 	rtems_status_code status;
> 
> 	status = rtems_interrupt_handler_install(CAN1_RX0_IRQn, "CANR", RTEMS_INTERRUPT_UNIQUE,
> 			(rtems_interrupt_handler) CAN1_RX0_IRQHandler, NULL);
> 	if (status != RTEMS_SUCCESSFUL) {
> 		printk("Pressure task interrupt install bombed with %d\n", status);
> 	}
> 
> and use the two call back functions HAL_CAN_RxCpltCallback and HAL_CAN_ErrorCallback in the same way as the ADC callbacks.
> 
> The symbol for external interrupt looks like EXTI0_IRQn and the UART would be like USART2_IRQn.
> 
> 
> Andrei from The Great White North.
> 
> 
> 
> 
> 
> 
> 
> -- 
> С уважением, Лещинский Ярослав.
> 
> +79814031224

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160819/ef96e105/attachment-0001.html>


More information about the users mailing list