Now that I have got the Pro C compiler working again I've now got what is probably a very trivial problem getting timers to work.
I've used STM32F4xx parts extensively over many years and can hard code various timer scenarios in my sleep.
I've got a STM32H743ZIT6 on a small plug in header pcb with a few leds, test pins, prog hdr and usb port that I can plug into a multiaxis cnc controller so I can use various cpu's depending on whats cost effective at the time
A simple bit of test code to do simple led blinks to prove timer run and interrupts will not run on this chip
The same code equivalent on Cube Ide works ok @ 480MHz sysclk, 240MHz timer clks
The same code on a STM32F407 on the same pcb header works ok
The project scheme setup file for the part seems ok (I've gone through it bit by bit as I've had bad mikroe setup files before that do not generate the correct config bits)
Running the code with a Delay_ms instead of interrupts works ok - so the core and clocks have started ok
Running the code at a slower clock (240 instead of 480MHz) does not work so unlikely to be timer core clocks maxed out
I'm only using this chip because it's fast and JLC PCB had enough in to give it a try (I also had some boards made with a STM32H723ZGT6 to compare)
My feeling is that there is some extra config bit(s) that the H7 range requires to start some clocks or global interrupts somewhere but I can't find them
(Sorry that the code is plain text, I can't find the method to insert it as code)
// STM32H743ZIT6 test prog
// sysclk = 480 MHz
// Timer clks = 240 MHz
#define USE_TIMER
#define TIMCLK 120 // for STM32H743 cpu @ 240 MHz
//#define TIMCLK 240 // for STM32H743 cpu @ 480 MHz
//#define TIMCLK 84 // for STM32F407 cpu @ 168 MHz
sbit LED_DATA at GPIOF_ODR.B13 ;
sbit LED_STATUS at GPIOF_ODR.B11 ;
sbit LED_ERROR at GPIOF_ODR.B12 ;
sbit TEST1 at GPIOF_ODR.B7 ;
sbit TEST2 at GPIOA_ODR.B4 ;
sbit TEST3 at GPIOD_ODR.B7 ;
sbit TEST4 at GPIOD_ODR.B2 ;
unsigned long SecCntr = 0 ;
unsigned char SubSecCntr = 0 ;
unsigned int TimeFlags ;
#define SubSecFlag TimeFlags.F0
#define SecFlag TimeFlags.F1
/*******************************************************************************/
// Interupts
/*******************************************************************************/
void Timer7_interrupt() iv IVT_INT_TIM7 ics ICS_AUTO { // 100 ms int
TIM7_SR.UIF = 0;
TEST1 = ~TEST1 ;
SubSecFlag = 1 ;
SubSecCntr++ ;
if(SubSecCntr >= 10) {
SubSecCntr = 0 ;
SecCntr++ ;
SecFlag = 1 ;
}
}
/*******************************************************************************/
// Main
/*******************************************************************************/
void main() {
GPIO_Digital_Output(&GPIOF_BASE, _GPIO_PINMASK_11) ;
GPIO_Digital_Output(&GPIOF_BASE, _GPIO_PINMASK_12) ;
GPIO_Digital_Output(&GPIOF_BASE, _GPIO_PINMASK_13) ;
GPIO_Digital_Output(&GPIOF_BASE, _GPIO_PINMASK_7) ;
GPIO_Digital_Output(&GPIOA_BASE, _GPIO_PINMASK_4) ;
GPIO_Digital_Output(&GPIOD_BASE, _GPIO_PINMASK_7) ;
GPIO_Digital_Output(&GPIOD_BASE, _GPIO_PINMASK_3) ;
LED_DATA = 0 ;
LED_STATUS = 0 ;
LED_ERROR = 0 ;
// Subsecs/secs timer
// TIM7 - Subsecs/secs
TIM7EN_bit = 1; // Enable clock
TIM7_CR1.CEN = 0; // Disable timer
TIM7_PSC = (TIMCLK * 10) - 1 ; // Set timer prescaler to get 100kHz clk, 10us period
TIM7_ARR = 10000 ; // set auto reload register to get 100ms interupts
NVIC_IntEnable(IVT_INT_TIM7); // Enable timer interrupt
TIM7_DIER.UIE = 1; // Update interrupt enable
TIM7_CR1.CEN = 1; // Enable timer
while(1) {
if(SecFlag == 1) { // secs rollover flag ?
SecFlag = 0 ; // yes, reset it
#ifdef USE_TIMER
LED_STATUS = ~LED_STATUS ;
TEST2 = ~TEST2 ;
#endif
}
if(SubSecFlag == 1) { // subsecs rollover flag ?
SubSecFlag = 0 ; // yes, reset it
}
#ifndef USE_TIMER
Delay_ms(1000);
LED_STATUS = ~LED_STATUS ;
TEST2 = ~TEST2 ;
#endif
}
}
/*******************************************************************************/
More STM32H743ZIT6 problems
General discussion on mikroC PRO for ARM.
Author
Message
-
- Posts: 4
- Joined: 05 Oct 2023 17:59
More STM32H743ZIT6 problems
#1 Post by sh@abbeywoodfarm.uk » 24 Apr 2024 19:26
- Attachments
-
- STM32H743ZIT6 test project.zip
- (183.77 KiB) Downloaded 11 times
-
- Posts: 4
- Joined: 05 Oct 2023 17:59
Re: More STM32H743ZIT6 problems
#2 Post by sh@abbeywoodfarm.uk » 05 May 2024 20:00
Back on the timer problem - yes it was trivial - the defs for the sfr's for this chip seem to be different from other mikro defs I've used on other stm32f4 chips
ie - was using TIM2_CR1.CEN but should be CEN_TIM2_CR1_bit for this particular chip
The BIG problem was that the compiler did not throw an error for that - (yet it did for several other sfr defs - that meant that I knew I had to lookup the new defs)
(another annoying ide problem is that right click/find declaration doesn't work most times - just goes to a random spot in the def file)
Lots of time wasted for that compiler problem (but I did learn some more stm32 fun facts along the way)
Now just the usb hid device prog to sort out
ie - was using TIM2_CR1.CEN but should be CEN_TIM2_CR1_bit for this particular chip
The BIG problem was that the compiler did not throw an error for that - (yet it did for several other sfr defs - that meant that I knew I had to lookup the new defs)
(another annoying ide problem is that right click/find declaration doesn't work most times - just goes to a random spot in the def file)
Lots of time wasted for that compiler problem (but I did learn some more stm32 fun facts along the way)
Now just the usb hid device prog to sort out
Return to “mikroC PRO for ARM General”
Jump to
- NECTO Studio
- ↳ IDE
- ↳ IDE General
- ↳ IDE Beta Testing
- ↳ IDE Wish List
- ↳ ARM AI Compilers
- ↳ mikroC AI for ARM
- ↳ mikroC AI for ARM General
- ↳ mikroC AI for ARM Beta Testing
- ↳ mikroC AI for ARM Wish List
- ↳ PIC AI compilers
- ↳ mikroC AI for PIC
- ↳ mikroC AI for PIC General
- ↳ mikroC AI for PIC Beta Testing
- ↳ mikroC AI for PIC Wish List
- ↳ PIC32 AI Compilers
- ↳ mikroC AI for PIC32
- ↳ mikroC AI for PIC32 General
- ↳ mikroC AI for PIC32 Beta Testing
- ↳ mikroC AI for PIC32 Wish List
- ↳ dsPIC AI Compilers
- ↳ mikroC AI for dsPIC
- ↳ mikroC AI for dsPIC General
- ↳ mikroC AI for dsPIC Beta Testing
- ↳ mikroC AI for dsPIC Wish List
- ↳ AVR AI Compilers
- ↳ mikroC AI for AVR
- ↳ mikroC AI for AVR General
- ↳ mikroC AI for AVR Beta Testing
- ↳ mikroC AI for AVR Wish List
- ↳ Additional Software
- ↳ Visual TFT AI
- ↳ Visual TFT AI General
- ↳ Visual TFT AI Beta Testing
- ↳ Visual TFT AI Wish List
- PRO Compilers
- ↳ PIC PRO Compilers
- ↳ PIC Compilers General
- ↳ mikroC PRO for PIC
- ↳ mikroC PRO for PIC General
- ↳ mikroC PRO for PIC Beta Testing
- ↳ mikroC PRO for PIC Wish List
- ↳ mikroBasic PRO compiler for PIC
- ↳ mikroBasic PRO for PIC General
- ↳ mikroBasic PRO for PIC Beta Testing
- ↳ mikroBasic PRO for PIC Wish List
- ↳ mikroPascal PRO for PIC
- ↳ mikroPascal PRO for PIC General
- ↳ mikroPascal PRO for PIC Beta Testing
- ↳ mikroPascal PRO for PIC Wish List
- ↳ dsPIC PRO Compilers
- ↳ dsPIC Compilers General
- ↳ mikroC PRO for dsPIC30/33 and PIC24
- ↳ mikroC PRO for dsPIC30/33 and PIC24 General
- ↳ mikroC PRO for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroC PRO for dsPIC30/33 and PIC24 Wish List
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24 General
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24 Wish List
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24 General
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24 Wish List
- ↳ PIC32 PRO Compilers
- ↳ PIC32 Compilers General
- ↳ mikroC PRO for PIC32
- ↳ mikroC PRO for PIC32 General
- ↳ mikroC PRO for PIC32 Beta Testing
- ↳ mikroC PRO for PIC32 Wish List
- ↳ mikroBasic PRO for PIC32
- ↳ mikroBasic PRO for PIC32 General
- ↳ mikroBasic PRO for PIC32 Beta Testing
- ↳ mikroBasic PRO for PIC32 Wish List
- ↳ mikroPascal PRO for PIC32
- ↳ mikroPascal PRO for PIC32 General
- ↳ mikroPascal PRO for PIC32 Beta Testing
- ↳ mikroPascal PRO for PIC32 Wish List
- ↳ AVR PRO Compilers
- ↳ AVR Compilers General
- ↳ mikroC PRO for AVR
- ↳ mikroC PRO for AVR General
- ↳ mikroC PRO for AVR Beta Testing
- ↳ mikroC PRO for AVR Wish List
- ↳ mikroBasic PRO compiler for AVR
- ↳ mikroBasic PRO for AVR General
- ↳ mikroBasic PRO for AVR Beta Testing
- ↳ mikroBasic PRO for AVR Wish List
- ↳ mikroPascal PRO for AVR
- ↳ mikroPascal PRO for AVR General
- ↳ mikroPascal PRO for AVR Beta Testing
- ↳ mikroPascal PRO for AVR Wish List
- ↳ FT90x PRO Compilers
- ↳ FT90x Compilers General
- ↳ mikroC PRO for FT90x
- ↳ mikroC PRO for FT90x General
- ↳ mikroC PRO for FT90x Beta Testing
- ↳ mikroC PRO for FT90x Wish List
- ↳ mikroBasic PRO compiler for FT90x
- ↳ mikroBasic PRO for FT90x General
- ↳ mikroBasic PRO for FT90x Beta Testing
- ↳ mikroBasic PRO for FT90x Wish List
- ↳ mikroPascal PRO for FT90x
- ↳ mikroPascal PRO for FT90x General
- ↳ mikroPascal PRO for FT90x Beta Testing
- ↳ mikroPascal PRO for FT90x Wish List
- ↳ 8051 PRO Compilers
- ↳ 8051 Compilers General
- ↳ mikroC PRO for 8051
- ↳ mikroC PRO for 8051 General
- ↳ mikroC PRO for 8051 Beta Testing
- ↳ mikroC PRO for 8051 Wish List
- ↳ mikroBasic PRO compiler for 8051
- ↳ mikroBasic PRO for 8051 General
- ↳ mikroBasic PRO for 8051 Beta Testing
- ↳ mikroBasic PRO for 8051 Wish List
- ↳ mikroPascal PRO for 8051
- ↳ mikroPascal PRO for 8051 General
- ↳ mikroPascal PRO for 8051 Beta Testing
- ↳ mikroPascal PRO for 8051 Wish List
- ↳ ARM PRO Compilers
- ↳ ARM Compilers General
- ↳ mikroC PRO for ARM
- ↳ mikroC PRO for ARM General
- ↳ mikroC PRO for ARM Beta Testing
- ↳ mikroC PRO for ARM Wish List
- ↳ mikroBasic PRO for ARM
- ↳ mikroBasic PRO for ARM General
- ↳ mikroBasic PRO for ARM Beta Testing
- ↳ mikroBasic PRO for ARM Wish List
- ↳ mikroPascal PRO for ARM
- ↳ mikroPascal PRO for ARM General
- ↳ mikroPascal PRO for ARM Beta Testing
- ↳ mikroPascal PRO for ARM Wish List
- ↳ Older versions of Compilers
- ↳ Older versions of mikroC Compilers
- ↳ mikroC for PIC
- ↳ mikroC General
- ↳ mikroC Beta Testing
- ↳ mikroC Wish List
- ↳ mikroC for dsPIC30/33 and PIC24
- ↳ mikroC for dsPIC30/33 and PIC24 General
- ↳ mikroC for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroC for dsPIC30/33 and PIC24 Wish List
- ↳ RSC-4x mikroC
- ↳ RSC-4x mikroC General
- ↳ RSC-4x mikroC Wish List
- ↳ mikroC Beta testing
- ↳ Older versions of mikroBasic Compilers
- ↳ mikroBasic compiler for PIC
- ↳ mikroBasic General
- ↳ mikroBasic Beta Testing
- ↳ mikroBasic Wish List
- ↳ mikroBasic compiler for dsPIC30/33 and PIC24
- ↳ mikroBasic for dsPIC30/33 and PIC24 General
- ↳ mikroBasic for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroBasic for dsPIC30/33 and PIC24 Wish List
- ↳ mikroBasic for dsPIC30/33 and PIC24 Bug List
- ↳ Obsolete Project: mikroBasic compiler for AVR
- ↳ mikroBasic for AVR General
- ↳ mikroBasic for AVR Wish List
- ↳ mikroBasic Beta testing
- ↳ Older versions of mikroPascal Compilers
- ↳ mikroPascal compiler for PIC
- ↳ mikroPascal FAQ
- ↳ mikroPascal General
- ↳ mikroPascal Beta Testing
- ↳ mikroPascal Wish List
- ↳ mikroPascal Bug List
- ↳ mikroPascal compiler for dsPIC30/33 and PIC24
- ↳ mikroPascal for dsPIC30/33 and PIC24 General
- ↳ mikroPascal for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroPascal for dsPIC30/33 and PIC24 Wish List
- ↳ mikroPascal for dsPIC30/33 and PIC24 Bug List
- ↳ Obsolete Project: mikroPascal compiler for AVR
- ↳ mikroPascal for AVR General
- ↳ mikroPascal for AVR Wish List
- ↳ mikroPascal Beta testing
- ↳ Library Development Discussion
- ↳ Code Requests
- Additional Software
- ↳ Visual TFT Software
- ↳ Visual TFT General
- ↳ Visual TFT Beta Testing
- ↳ Visual TFT Wish List
- ↳ Visual GLCD Software
- ↳ Visual GLCD General
- ↳ Visual GLCD Beta Testing
- ↳ Visual GLCD Wish List
- ↳ Package Manager Software
- ↳ Package Manager General
- ↳ Package Manager Beta Testing
- ↳ Package Manager Wishlist
- ↳ GLCD Font Creator Software
- ↳ SpeakUp Software
- ↳ Timer Calculator
- ↳ CAN Calculator
- ↳ mikroBootloader
- Hardware
- ↳ Development Boards
- ↳ CODEGRIP programmer and debugger
- ↳ Mikromedia
- ↳ mikroProg™ programmer and debugger
- ↳ Development Boards Wishlist
- ↳ Review
- ↳ Click Boards release
- ↳ Hexiwear
- Website & Forums
- ↳ Libstock Discussion
- ↳ Product Announcements
- ↳ Website & Forums General Discussion
- ↳ Website & Forums Wishlist
- ↳ User Projects