Wrong clk interpretation by compiler

General discussion on mikroBasic PRO for ARM.
Post Reply
Author
Message
Alessandro Fulignani
Posts: 101
Joined: 04 Nov 2016 13:09

Wrong clk interpretation by compiler

#1 Post by Alessandro Fulignani » 25 Jun 2018 18:12

Hi Everybody,

I am testing the kinestis clicker with MK22FN512VLH12 and the basic compiler for ARM V6.0.0

There are two problems:

1) The compiler itself it's becomed very slow to draw the screen and to react to the commands.
2) The compiler does not read correctly the programmed frequency in the "Edit project" menu

The point two it is limiting the use of almost all the internal librarys. As you know, most of the internal routines read the clock and mange the CLK cycles based on the programmed MCU frequency.
Right now, i have to find by my self and declare a frequency that match the real MCU frequency. Doing that i can see everything working fine.

Can you provide a solution for that ?

Thank you,

Alex

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Wrong clk interpretation by compiler

#2 Post by petar.suknjaja » 28 Jun 2018 07:58

Hi Alex,

Could you tell me in more details if it is related to a particular project,or when it started to happen?
Have you tried to reinstall the mikroBasic compiler?

Kind regards,
Petar

Alessandro Fulignani
Posts: 101
Joined: 04 Nov 2016 13:09

Re: Wrong clk interpretation by compiler

#3 Post by Alessandro Fulignani » 28 Jun 2018 09:59

Hi Petar,

1) As discussed with your collegue Filip, i have discovered the origin of the reduced redraw speed. It is something related to W10. If you select the voice "core isolation" in the device security panel you are disabling the hyper threding system of the x86 CPU. This seem to strongly affect the performances of some programs.

2) No. It is a long time that i did not install a clean version of uB.

I will keep you informed.

Thank you,

Alessandro

Alessandro Fulignani
Posts: 101
Joined: 04 Nov 2016 13:09

Re: Wrong clk interpretation by compiler

#4 Post by Alessandro Fulignani » 29 Jun 2018 10:45

Hi Petar,

I did a new uB installation but it does not change anything.


Here, a brief descrption about what i am doing to test the MCU:

If you set the MCU frequency in the uB "Edit project" panel to 1Mhz you should see the led blinking with 1s period.
But if you run the small program that i have pasted, you will see that to get the correct blinking frequency you must put in the PIT_LDVAL1=31999999
So it seem that the real MCU frequency is 32Mhz.
The MCU is the Kinetis MK22FN512XXX12 (Kinetis clicker 2)

Thank you,

Alessandro

Test program:

sub procedure InitTimer0()

SIM_SCGC6.PIT = 1
PIT_MCR = 0x00
PIT_LDVAL0 = 999999
PIT_TCTRL0 = 3

end sub

sub procedure prova_timer() iv IVT_INT_PIT0 ics ICS_AUTO

PTA_PDOR.B12 = not PTA_PDOR.B12

PIT_TFLG0.TIF = 1

end sub

main:

GPIO_Digital_Output(@PTA_PDOR,_GPIO_PINMASK_12 or _GPIO_PINMASK_5)
PORTA_PCR13 = 0xA0000
PORTA_PCR4 = 0xA0000
GPIO_Digital_Input(@PTA_PDIR,_GPIO_PINMASK_13 or _GPIO_PINMASK_4)

InitTimer0()

PTA_PDOR.B12 = 0
PTA_PDOR.B5 = 0

NVIC_IntEnable(IVT_INT_PIT0)


while true

wend

end.

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Wrong clk interpretation by compiler

#5 Post by petar.suknjaja » 29 Jun 2018 14:06

Hi Alessandro,
I will try to reproduce the same behavior.
Could you send me in the meantime whole project zipped ?
Kind regards,
Petar

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Wrong clk interpretation by compiler

#6 Post by petar.suknjaja » 29 Jun 2018 15:01

Can you tell me more about the clock scheme that you have been using in this example?
The clock scheme that is used in example must match the configuration oscillator bits
that are accessible in the Edit Project options in the mikroBasic compiler.
Kind regards,
Petar

Alessandro Fulignani
Posts: 101
Joined: 04 Nov 2016 13:09

Re: Wrong clk interpretation by compiler

#7 Post by Alessandro Fulignani » 03 Jul 2018 09:38

Hi Petar,

First issue solved. It was a my fault. I totally forgot that i needed to match the programmed frequency with the MCU clk generator.

Sorry for that. I am working on several platform and several project...

Soon i will replay to you about the other stuff.

Thank you

Alessandro

Post Reply

Return to “mikroBasic PRO for ARM General”