I have been searching for days trying to find a library or description of how to set up Timer Interrupts on the Arduino Giga. I have tried many libraries but they seem to not be compatible.
Can someone please post instructions of how to create for example a timer interrupt at 100Hz calling an ISR where you enter the ISR with CLI and SEI (as I understand it noInterrupts() and interrupts()). Either this or post a link to where this information is available.
I just started playing with the GIGA R1 boards, and was wondering about timers. I thought, i might try this library which is now archived. So I create a fork of it.
First thing I did was to update all of the #if to include the GIGA board and then tried a few examples.
I found the PWM_Multi which crashed. Figured maybe not all of the IO pins match so I updated to ones that I believe are PWM pins.
Like:
But first thing I wondered what IO pins might work, so created Excel document with the Pin Numbers mapped to the physical pin and then the functionality for each pin... I often do this on new boards, to help better understand them.
Here is the first part of it:
Arduino
Function
Port
AF0
AF1
AF2
AF3
AF4
AF5
AF6
AF7
AF8
AF9
AF10
AF11
AF12
AF13
AF14
AF15
0
RX
PB7
-
TIM17_CH1 N
TIM4_CH2
HRTIM_EEV 9
I2C1_SDA
-
I2C4_SDA
USART1_ RX
LPUART1_ RX
FDCAN2_ TXFD_ MODE
-
DFSDM1_C KIN5
FMC_NL
DCMI_VSY NC
-
EVENT OUT
1
TX
PA9
-
TIM1_CH2
HRTIM_ CHC1
LPUART1_ TX
I2C3_SMBA
SPI2_SCK/ I2S2_CK
-
USART1_ TX
-
FDCAN1_ RXFD_ MODE
-
ETH_TX_ ER
-
DCMI_D0
LCD_R5
EVENT OUT
2
PA3
TIM2_CH4
TIM5_CH4
LPTIM5_ OUT
TIM15_CH2
-
-
USART2_ RX
-
LCD_B2
OTG_HS_ ULPI_D0
ETH_MII_ COL
-
-
LCD_B5
EVENT OUT
3
PA2
TIM2_CH3
TIM5_CH3
LPTIM4_ OUT
TIM15_CH1
-
-
USART2_ TX
SAI2_SCK _B
-
-
ETH_MDIO
MDIOS_ MDIO
-
LCD_R1
EVENT OUT
4
PJ8
-
TIM1_CH3N
-
TIM8_CH1
-
-
-
-
UART8_TX
-
-
-
-
-
LCD_G1
EVENT OUT
5
PA7
-
TIM1_CH1N
TIM3_CH2
TIM8_CH1N
-
SPI1_MOSI /I2S1_SDO
-
-
SPI6_MOSI
TIM14_ CH1
ETH_MII_R X_DV/ETH_ RMII_CRS_ DV
FMC_ SDNWE
-
-
EVENT OUT
6
PD13
-
LPTIM1_ OUT
TIM4_CH2
I2C4_SDA
-
-
QUADSPI_ BK1_IO3
SAI2_SCK_ A
-
FMC_A18
-
-
EVENT OUT
7
PB4
NJTRST
TIM16_BKIN
TIM3_CH1
HRTIM_EEV 6
-
SPI1_MISO /I2S1_SDI
SPI3_MISO/ I2S3_SDI
SPI2_NSS/ I2S2_WS
SPI6_MISO
SDMMC2_ D3
-
UART7_TX
-
-
-
EVENT OUT
8
PB8
-
TIM16_CH1
TIM4_CH3
DFSDM1_C KIN7
I2C1_SCL
-
I2C4_SCL
SDMMC1_ CKIN
UART4_RX
FDCAN1_ RX
SDMMC2_ D4
ETH_MII_ TXD3
SDMMC1_ D4
DCMI_D6
LCD_B6
EVENT OUT
9
PB9
-
TIM17_CH1
TIM4_CH4
DFSDM1_ DATIN7
I2C1_SDA
SPI2_NSS/ I2S2_WS
I2C4_SDA
SDMMC1_ CDIR
UART4_TX
FDCAN1_ TX
SDMMC2_ D5
I2C4_SMBA
SDMMC1_ D5
DCMI_D7
LCD_B7
EVENT OUT
10
PK1
-
TIM1_CH1
-
TIM8_CH3N
-
SPI5_NSS
-
-
-
-
-
-
-
-
LCD_G6
EVENT OUT
11
PJ10
-
TIM1_CH2N
-
TIM8_CH2
-
SPI5_MOSI
-
-
-
-
-
-
-
-
LCD_G3
EVENT OUT
12
PJ11
-
TIM1_CH2
-
TIM8_CH2N
-
SPI5_MISO
-
-
-
-
-
-
-
-
LCD_G4
EVENT OUT
13
PH6
-
-
-
-
I2C2_SMBA
SPI5_SCK
-
-
-
-
-
ETH_MII_R XD2
FMC_SDNE 1
DCMI_D8
-
EVENT OUT
Again just playing around. The XLS file is up in my UNO R4 github project
Edit: Wondering if this should be in the Hardware GIGA forum.?
Hello!
Could you confirm is it actually working?
I just got a Giga R1 Wifi today, but the compiler said that the library is not compatible with the mbed_giga.
I know your WIP is just an experiment, but I'm seeing the same problem as user jmwinding above. I suspect it is just a cockpit error on my part, not being 100% clear on how to install it.
I am an experienced embedded programmer but a novice at Arduino. Working on porting a small program from Uno to Giga. The original Uno code set up an ATMega328P peripheral timer to trigger an interrupt. That is how I found this repository, since it seems the support for doing this within the Ardino system is lacking.
I am not certain I need to configure a hardware timer interrupt -- there may be a native Arduino solution that is good enough for my application. Alternatively, I could hard code the STM32H7 configuration code myself ( I have written C++ projects on the H7 recently in non-Arduino land).
Sorry, I have not been playing much with the GIGA for a while. Been back mostly doing coding for Teensy boards...
And I have not done anything on this probably this year.
But for example when I was playing with their USB Host code base and attempting to port some of the different devices we support on a Teensy USB Host, I needed a latency timeout. On the Teensy USB host code, there was already an Millisecond timer for USB Start of Frame... That we hooked into to then flush out any stuff still in our output buffer...
Okay, I fixed it and I was operator error. Somehow in my various attempts to install your forked library, I had accidentally installed the original version by mistake. Once I realized that, I wiped out the folder in the Documents/Arduino/libraries directory and replaced with the clone of your fork.
Now a simple test sketch compiles and runs correctly. There is still a warning being emitted somewhere saying
WARNING: library Portenta_H7_TimerInterrupt claims to run on mbed, mbed_portenta, ArduinoCore-mbed architecture(s) and may be incompatible with your current board which runs on mbed_giga architecture(s).
But it's just a warning. Later on when it annoys me too much, I'll track down the source of that warning and fix it.
Hello!
I've been trying to run the PWM program that u made in Giga R1, but there's some error that said
error: #error This code is intended to run on the MBED ARDUINO_PORTENTA_H7 platform! Please check your Tools->Board setting. #error This code is intended to run on the MBED ARDUINO_PORTENTA_H7 platform! Please check your Tools->Board setting.
^~~~~
exit status 1
do u have any solution to solve this error? Thank you ^^
100Hz is every 10ms... how precisely do you need to hit that mark? What's your tolerance since you could be within 50 micros almost always without using interrupts at all on a 16MHz Uno just using non-blocking code. I'm not kidding! Usually we say "within a millisecond" for extra margin, it was the lesson du jour here since before 2011 when I arrived but with care, you can hold 20usecs on average with many soft-timers at once.