First project

General discussion on mikroPascal PRO for ARM.
Post Reply
Author
Message
Nebulix
Posts: 9
Joined: 30 Mar 2015 11:43

First project

#1 Post by Nebulix » 30 Mar 2015 12:21

I tried the "first project" and got :
0 340 File 'C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for ARM\Uses\ST M4\__Lib_SoftUART.mpas' not found
0 340 File 'C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for ARM\Uses\ST M4\__Lib_Sound.mpas' not found

The files 'C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for ARM\Uses\ST M4\__Lib_Sound.EMCL' and __Lib_SoftUART.EMCL are present in the folder.

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: First project

#2 Post by Aleksandar.Mitrovic » 31 Mar 2015 17:03

Hi Nebulix,

As the name "first project" whether it referred to Led Blinking example?

Can you please send me your project in small zipped form how could I will be able to reproduce the problem.
Also which development system and microcontroller do you use for your example?

Best regards,
Aleksandar

Nebulix
Posts: 9
Joined: 30 Mar 2015 11:43

Re: First project

#3 Post by Nebulix » 01 Apr 2015 08:53

I am trying to operate a STM32F407VG-discovery board. Without any success so far !
I tried the 'first project' but could not even build it because of missing files in the library. I do not understand why I should need a sound library for this project but I did not find where they were evoqued and how to exclude them. Also these files are present in emcl format but not in mpas. Is there a way to convert ?
I also noticed that the software did not detect the mcu. How Should I do ?
Thanks
Gilbert
Attachments
mikrop1.JPG
mikrop1.JPG (155.49 KiB) Viewed 4333 times

Nebulix
Posts: 9
Joined: 30 Mar 2015 11:43

Re: First project

#4 Post by Nebulix » 01 Apr 2015 16:54

I reloaded the example from the downloaded library and it builds correctly. Sorry.
But the board is still not founs.

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: First project

#5 Post by Aleksandar.Mitrovic » 02 Apr 2015 16:04

Hi,

Did you program your Discovery board before?
Can you please check jumpers on you Discovery board for programming?

Best regards,
Aleksandar

Nebulix
Posts: 9
Joined: 30 Mar 2015 11:43

Re: First project

#6 Post by Nebulix » 03 Apr 2015 08:38

I just plugged both USB connectors and observed blinking leds and the demo accelerometer program.
Jumpers JP1, JP2, JP3 and both ST-LINK are on (connected).
Thanks again

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: First project

#7 Post by Aleksandar.Mitrovic » 03 Apr 2015 13:54

Hi,

I'm afraid that I didn't understand you completely.

Can you confirm that you solve your problem and that you manage to program your Discovery board?

Best regards,
Aleksandar

Nebulix
Posts: 9
Joined: 30 Mar 2015 11:43

Re: First project

#8 Post by Nebulix » 03 Apr 2015 14:26

I can build a project and generate a .hex file.
I cannot upload it to the board.

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: First project

#9 Post by Aleksandar.Mitrovic » 03 Apr 2015 15:37

Hi,

Which operating system do you use?
Can you tell me do you use on board programmer or some other?
Also I suggest you to attach some picture of the board connected to PC.

I can suggest you couple solutions that you can try first:
1. Download latest drivers for your system from ST web site
2. Run mikroProg Suite as administrator
3. Also in mikroProg Suite go to Options-->Hardware: STLink must be check if you are using him (see the picture attached below)
example1.JPG
example1.JPG (48.61 KiB) Viewed 4298 times
Best regards,
Aleksandar

Nebulix
Posts: 9
Joined: 30 Mar 2015 11:43

Re: First project

#10 Post by Nebulix » 08 Apr 2015 15:43

Hi
I purchased a mini-m4 board. I succeded in compiling the ledblinking program, uploading it and running it. I even modified the blinking rate. Then I tried a more useful program with two functions :
Reading an analog signal at PA3 and outputting a function of it at PA4
Reading a digital signal at PB0 and outputting its inverse at PC0
I mostly pasted parts from examples but nothing works. I probably missed some point, but which ?
Thank you

program MyProject4;

{ Declarations section }
var value : word;
var conf1 : dword;
var conf2 : dword;
var STAT_LED : sbit at ODR13_GPIOC_ODR_bit;
var DATA_LED : sbit at ODR12_GPIOC_ODR_bit;

begin
{ Main program }
GPIO_Digital_Input(@GPIob_BASE, _GPIO_PINMASK_all );
GPIO_Digital_Output(@GPIOc_base, _GPIO_PINMASK_ALL); // Set PORTc as output
GPIO_Clk_Enable(@GPIOb_BASE);// is this necessary ?
GPIO_Clk_Enable(@GPIOC_BASE);
GPIO_Clk_Enable(@GPIOA_BASE);

DAC1_Init(_DAC_CH1_ENABLE or _DAC_CH2_ENABLE);

ADC_Set_Input_Channel(_ADC_CHANNEL_3); // Choose ADC channel (does it correspond to port PA3 ?)
ADC1_Init(); // Init adcX_init x=0,1
Delay_ms(100);
value := 0;
conf1 := _DAC_12_BIT or _DAC_TRIGGER_SW or _DAC_RIGHT_ALIGN;
conf2 := _DAC_12_BIT or _DAC_TRIGGER_SW or _DAC_RIGHT_ALIGN;

while TRUE do
begin
GPIOc_ODR := not(GPIOb_IDR); //is it possible to address individual bits ?
STAT_LED :=not STAT_LED; //for test

value := ADC1_Get_Sample(3); // Get ADC value from corresponding channel
//Delay_ms(20);

DAC1_Advanced_Ch1_Output(4095-value, conf1);
end;
end.

Nebulix
Posts: 9
Joined: 30 Mar 2015 11:43

Re: First project

#11 Post by Nebulix » 09 Apr 2015 15:15

Well, I had it working ...
In View > Project settings, the clock frequency was set to 16 MHz. By setting it to 120 (as in the ledblinking) or 168, it works !!!
Can anyone explain ?

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: First project

#12 Post by Aleksandar.Mitrovic » 09 Apr 2015 16:37

Hi,

I'm glad that you find solution to your problem.

16MHz is to low for ARM microcontroller to operate with all functions.

Best regards,
Aleksandar

Post Reply

Return to “mikroPascal PRO for ARM General”