STM32F3Discovery not working

General discussion on mikroBasic PRO for ARM.
Post Reply
Author
Message
indesigns
Posts: 3
Joined: 18 Jun 2019 02:29

STM32F3Discovery not working

#1 Post by indesigns » 18 Jun 2019 03:01

Hi,

I have used the MikroC Pro for ARM somewhat, made a few programs that worked...also bought the registered version in dongle form.

Recently, MikroC updated, and now any program that I make does not run...the microprocessor seems to hang. I did a very basic new program to prove the tool chain...and it still does not do a thing. Code snippet below:

sbit Ld7 at GPIOE_ODR.B11;

void main() {
GPIO_Clk_Enable(&GPIOE_BASE);
GPIO_Digital_Output(&GPIOE_BASE, _GPIO_PINMASK_11|_GPIO_PINMASK_12);

while (1) {
Ld7=~Ld7;
Delay_ms(100);
}

}

I'm using Mikro C 6.2 with the STMicroElectronics ST-Link.

Below is the assembly code generated:
_main:
;MyProject.c,3 :: void main() {
;MyProject.c,4 :: GPIO_Clk_Enable(&GPIOE_BASE);
MOVW R0, #lo_addr(GPIOE_BASE+0)
MOVT R0, #hi_addr(GPIOE_BASE+0)
BL _GPIO_Clk_Enable+0
;MyProject.c,5 :: GPIO_Digital_Output(&GPIOE_BASE, _GPIO_PINMASK_11|_GPIO_PINMASK_12);
MOVW R1, #6144
MOVW R0, #lo_addr(GPIOE_BASE+0)
MOVT R0, #hi_addr(GPIOE_BASE+0)
BL _GPIO_Digital_Output+0
;MyProject.c,7 :: while (1) {
L_main0:
;MyProject.c,8 :: Ld7=~Ld7;
MOVW R2, #lo_addr(GPIOE_ODR+0)
MOVT R2, #hi_addr(GPIOE_ODR+0)
LDR R1, [R2, #0]
UBFX R0, R1, #11, #1
EOR R1, R0, #1
LDR R0, [R2, #0]
BFI R0, R1, #11, #1
STR R0, [R2, #0]
;MyProject.c,9 :: Delay_ms(100);
MOVW R7, #4521
MOVT R7, #4
NOP
NOP
L_main2:
SUBS R7, R7, #1
BNE L_main2
NOP
NOP
;MyProject.c,10 :: }
IT AL
BAL L_main0
;MyProject.c,12 :: }
L_end_main:
L__main_end_loop:
B L__main_end_loop
; end of _main


Please advise...if it would be helpful, I could zip the entire project and provide link.

Thanks

- Rick

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32F3Discovery not working

#2 Post by stefan.filipovic » 18 Jun 2019 17:01

Hi Rick,

Welcome to the mikroE forum.

How did you set configuration bits in the Edit Project?

Would you like to attach your project (zipped), or send it directly to my email [stefan.filipovic@mikroe.com]?

Kind regards,
Stefan Filipović

indesigns
Posts: 3
Joined: 18 Jun 2019 02:29

Re: STM32F3Discovery not working

#3 Post by indesigns » 19 Jun 2019 00:55

Hi Stefan,

Please find attached.

Using the internal RC oscillator for the clock.

Thanks for you help as well.

- Rick
Attachments
D.zip
(157.79 KiB) Downloaded 82 times

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32F3Discovery not working

#4 Post by stefan.filipovic » 19 Jun 2019 13:24

Hi Rick,

There is a mistake in the STM32F303VC.mlk file.
Please press Ctrl+Alt+M to open up mlk file, and modify the node for RAM memory range as shown below:

Code: Select all

<RAM>
		<MIN_ADDR>0x20000000</MIN_ADDR>
		<MAX_ADDR>0x20009FFF</MAX_ADDR>
</RAM>
Please let me know does it works after that. Don't forget to Rebuild All Sources (Alt+F9) after modifying.

I will forward this to our developers, I apologize for the inconvenience caused by this.

Kind regards,
Stefan Filipović

indesigns
Posts: 3
Joined: 18 Jun 2019 02:29

Re: STM32F3Discovery not working

#5 Post by indesigns » 20 Jun 2019 01:59

Right on Stefan...worked like a charm.

Thanks very much for your help.

Best regards,

- Rick

User avatar
stefan.filipovic
mikroElektronika team
Posts: 1135
Joined: 18 Dec 2018 10:30

Re: STM32F3Discovery not working

#6 Post by stefan.filipovic » 20 Jun 2019 12:02

Hi Rick,

You're welcome.

Kind regards,
Stefan Filipović

Post Reply

Return to “mikroBasic PRO for ARM General”