More STM32H743ZIT6 problems

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
sh@abbeywoodfarm.uk
Posts: 3
Joined: 05 Oct 2023 17:59

More STM32H743ZIT6 problems

#1 Post by sh@abbeywoodfarm.uk » 24 Apr 2024 19:26

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
}
}

/*******************************************************************************/
Attachments
STM32H743ZIT6 test project.zip
(183.77 KiB) Downloaded 5 times

Post Reply

Return to “mikroC PRO for ARM General”