cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie trying to make multiple GPIO Inputs in same EXTI line, options?

suresh
Associate II
Posted on February 05, 2016 at 22:20

Hello, my board designed with STM32F0 (100 pin) controller with 28 pins as input pins and 32 pins as output pins. All of the GPIO Inputs are time critical, required to sense both rising and falling edges. 

For this thought of configure all inputs as external interrupts. After experiment (in STM32091C-EVAL) and extensive google search found at maximum 15 pins only configurable as external interrupt pins

(https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fhandling%20multiple%20interrupts%20on%20same%20EXTI%20line%20in%20STM32&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=6035).

With respect to this, short listed very high polarity change inputs pins and configured as EXTI interrupt pins. 

For remaining 13 pins, to detect both rising and falling edges would like to poll with maximum resolution of One millisecond. 

For this planning to use, TIM1 (Counter Period (1 ) in HAL_TIM_PeriodElapsedCallback() mode.

Is there any better alternative peripheral mechanisms /ways with in STM32 core?

Regards,

#stm32-gpio-architecture
6 REPLIES 6
Radosław
Senior
Posted on February 05, 2016 at 22:29

STM32 is a microkontroler not FPGA.

Why you need so many extarnal interrupts?  1 milisecond for STM is like ages.

Explain what you wanna to do

Posted on February 05, 2016 at 22:44

Went citing threads, please use the World+Chain icon, don't put them in a sentence with brackets as it makes it even harder to click on or copy them, especially with the ridiculous line length ST generates.

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/handling%20multiple%20interrupts%20on%20same%20EXTI%20line%20in%20STM32&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE...

The Period One thing makes no sense to me. If you want a 1ms timer, configure the timer to do that, or a higher frequency update. The SysTick is also typically configured at 1KHz (1ms)

Not sure of the efficacy of doing timing-critical stuff in software, if there is strong timing relationship between the inputs and outputs, consider a CPLD. In the STM32 you could use timers, but the numbers you are talking about seem to exceed the available resources.

I haven't review the part, but I'd expect 16 EXTI sources to be usable.

A tight loop monitoring a bank of GPIO could detect changes quite quickly. Not sure of the processing requirements here, or the relationship between input and output.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
suresh
Associate II
Posted on February 05, 2016 at 22:45

Instrument is going to be like medical data logger with ADC, DI/O lines. Collects data from different sources and sends to host over serial communication with 115.2 K BPS.

This instrument won't scan all the peripherals at once, based on some external logic in a period of time scans group of channels. It happened, for all the inputs we required to scan in a period of time.

Hopes this helps.

Thanks,

suresh
Associate II
Posted on February 08, 2016 at 16:01

Hello, Is there a example to detect level change in GPIO lines by using timer interrupt?

Thanks,

Jim

Posted on February 08, 2016 at 16:15

The keyword, you are looking for, is ''capture''.

JW

Posted on February 08, 2016 at 19:37

Hello, Is there a example to detect level change in GPIO lines by using timer interrupt?

A periodic one?

STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\SysTick\TimeBase

Add code in the SysTick_Handler() to read a GPIOx->IDR and then mask that and XOR it with a prior value to see what changed interval to interval. You'd need to craft around your specific hardware.

Several other EXTI and TIM related examples in there too

STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\EXTI\EXTI_Config\

The HAL/Cube libraries likely have similar examples within the package also.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..