EmbeddedRelated.com
Forums
Memfault Beyond the Launch

LPC1769 timer issue

Started by r_goncalves2000 February 16, 2012
Hello

I'm using an LPC1769 and CMSISv2p00_LPC17xx.
I use a 12MHz crystal and the CPU is running at 120MHZ.
In my board I use the UART0, I2C, watchdog, LCD, etc..
I also have timer 0 running.

Sometimes after a reset it seens like the timer is running without the correct value but much more slower.
Everything else seems to work ok (UART, E2PROM access, LCD, etc...)
This problem seens to be worst after a software reset (wich I make just by writing an invalid feed sequence to the watchdog).

I print over the serial UART the values of some timer registers when the timer is running ok and when the timer is not running ok and the values are the same (CCR, TCR, PR, IR, MR0, MCR).
I also print the value of SystemCoreClock and in both situations the value is correct.
I could not found anything in the errata sheet.
Can anybody give me a sugestion to find what's the problem?

Another issue (wich I don't know if it's related or not) but sometimes the UART sends garbage characters.
After some garbage characters the UART starts working OK.
Any thoughts about what is hapenning?.

Rui

An Engineer's Guide to the LPC2100 Series

Also check if the peripheral clock is set correctly for your timer.

I assume that the garbage on your uart happens only after a reset and/or connection of a serial cable. This happens to me also and has never caused me any problems. I think that this happens to be some spikes on the line during init or connection.

--- In l..., "r_goncalves2000" wrote:
>
> Hello
>
> I'm using an LPC1769 and CMSISv2p00_LPC17xx.
> I use a 12MHz crystal and the CPU is running at 120MHZ.
> In my board I use the UART0, I2C, watchdog, LCD, etc..
> I also have timer 0 running.
>
> Sometimes after a reset it seens like the timer is running without the correct value but much more slower.
> Everything else seems to work ok (UART, E2PROM access, LCD, etc...)
> This problem seens to be worst after a software reset (wich I make just by writing an invalid feed sequence to the watchdog).
>
> I print over the serial UART the values of some timer registers when the timer is running ok and when the timer is not running ok and the values are the same (CCR, TCR, PR, IR, MR0, MCR).
> I also print the value of SystemCoreClock and in both situations the value is correct.
> I could not found anything in the errata sheet.
> Can anybody give me a sugestion to find what's the problem?
>
> Another issue (wich I don't know if it's related or not) but sometimes the UART sends garbage characters.
> After some garbage characters the UART starts working OK.
> Any thoughts about what is hapenning?.
>
> Rui
>

Thanks Kevin.

PCLKSEL0 register as the same value in both situations.
I'm using match 0 interruption, and timer 0 clock equal to 120MHz.
I'm setting interruption time to 1ms.

I use UART 0 for debug and to change application parameters.
When the problem occurs the first debug messages that I send are lost
because trash is send.
I send debug messages imediatly after UART 0 initialization.
But this problem doesn't occur every time a reset occurs.

Rui

Citando Kevin :
>
>
>
> Also check if the peripheral clock is set correctly for your timer.
>
> I assume that the garbage on your uart happens only after a
> reset and/or connection of a serial cable. This happens to me also
> and has never caused me any problems. I think that this happens to
> be some spikes on the line during init or connection.
>
> --- In l...[1], "r_goncalves2000"
> wrote:
> >
> > Hello
> >
> > I'm using an LPC1769 and CMSISv2p00_LPC17xx.
> > I use a 12MHz crystal and the CPU is running at 120MHZ.
> > In my board I use the UART0, I2C, watchdog, LCD, etc..
> > I also have timer 0 running.
> >
> > Sometimes after a reset it seens like the timer is running
> without the correct value but much more slower.
> > Everything else seems to work ok (UART, E2PROM access, LCD, etc...)
> > This problem seens to be worst after a software reset (wich
> I make just by writing an invalid feed sequence to the watchdog).
> >
> > I print over the serial UART the values of some timer
> registers when the timer is running ok and when the timer is not
> running ok and the values are the same (CCR, TCR, PR, IR, MR0, MCR).
> > I also print the value of SystemCoreClock and in both
> situations the value is correct.
> > I could not found anything in the errata sheet.
> > Can anybody give me a sugestion to find what's the problem?
> >
> > Another issue (wich I don't know if it's related or not) but
> sometimes the UART sends garbage characters.
> > After some garbage characters the UART starts working OK.
> > Any thoughts about what is hapenning?.
> >
> > Rui
> >
>
>
>

Ligações:
---------
[1] mailto:lpc2000%40yahoogroups.com
[2] mailto:l...@slomotion.nl?subject=Re%3A%20LPC1769%20timer%20issue
[3] mailto:l...?subject=Re%3A%20LPC1769%20timer%20issue
[4]
http://groups.yahoo.com/group/lpc2000/post;_ylc=X3oDMTJyMmQ2NDg1BF9TAzk3MzU5NzE0BGdycElkAzExNDUzMTY2BGdycHNwSWQDMTcwNjU1NDIwNQRtc2dJZAM1NjM5MARzZWMDZnRyBHNsawNycGx5BHN0aW1lAzEzMjkzODgwODA-?act=reply&messageNum=56390
[5]
http://groups.yahoo.com/group/lpc2000/post;_ylc=X3oDMTJmYm81bGptBF9TAzk3MzU5NzE0BGdycElkAzExNDUzMTY2BGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDZnRyBHNsawNudHBjBHN0aW1lAzEzMjkzODgwODA-
[6]
http://groups.yahoo.com/group/lpc2000/message/56389;_ylc=X3oDMTM3Y28wcTQ0BF9TAzk3MzU5NzE0BGdycElkAzExNDUzMTY2BGdycHNwSWQDMTcwNjU1NDIwNQRtc2dJZAM1NjM5MARzZWMDZnRyBHNsawN2dHBjBHN0aW1lAzEzMjkzODgwODAEdHBjSWQDNTYzODk-
[7]
http://groups.yahoo.com/group/lpc2000/members;_ylc=X3oDMTJndnR1cHIxBF9TAzk3MzU5NzE0BGdycElkAzExNDUzMTY2BGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDdnRsBHNsawN2bWJycwRzdGltZQMxMzI5Mzg4MDgw?o=6
[8]
http://groups.yahoo.com/group/lpc2000;_ylc=X3oDMTJmcGFuaGdiBF9TAzk3MzU5NzE0BGdycElkAzExNDUzMTY2BGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzEzMjkzODgwODA-
[9]
http://groups.yahoo.com/;_ylc=X3oDMTJlaDlvNG1hBF9TAzk3MzU5NzE0BGdycElkAzExNDUzMTY2BGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTMyOTM4ODA4MA--
[10]
mailto:l...?subject=Change%20Delivery%20Format:%20Traditional
[11] mailto:l...?subject=Email%20Delivery:%20Digest
[12] mailto:l...?subject=Unsubscribe
[13] http://docs.yahoo.com/info/terms/


In the errata there is a problem with the PCLKSEL, I'm not sure if that is what causing the problem. PCLKSEL must be set before PLL is enabled.
By how much is the timer of time?
And is this difference always the same?

--- In l..., "rpsgoncalves@..." wrote:
>
> Thanks Kevin.
>
> PCLKSEL0 register as the same value in both situations.
> I'm using match 0 interruption, and timer 0 clock equal to 120MHz.
> I'm setting interruption time to 1ms.
>
> I use UART 0 for debug and to change application parameters.
> When the problem occurs the first debug messages that I send are lost
> because trash is send.
> I send debug messages imediatly after UART 0 initialization.
> But this problem doesn't occur every time a reset occurs.
>
> Rui
>

Hello Kevin.

That was inded the problem.
I found that issue in the errata but the first time I analise that I didn't believe that could be the origin of the problem.
I overlooked this situation because all pheripherals work well.
Even the timer 0 only failed some time.

By looking again to the CMSIS code I found that there is a value for PCLKSEL0 that is set prior to the PLL0 being active.
In the code I couldn't found any comments to warn about this situation.

In my code I set PCLKSEL0/1 bits in the initialization routine of each peripheral.
Now I changed it and the only time I change PCLKSEL0/1 is in the CMSIS code.

Now the problem does not apear.

In relation to the UART, I believe that was also the problem.
Now I don't have trash and I receive all the debug messages just from the start of the application.
It seens to me that UART0 is able to correct from the problem but timer 0 not.

Thanks for your help.

Rui

--- In l..., "Kevin" wrote:
>
> In the errata there is a problem with the PCLKSEL, I'm not sure if that is what causing the problem. PCLKSEL must be set before PLL is enabled.
> By how much is the timer of time?
> And is this difference always the same?
>
> --- In l..., "rpsgoncalves@" wrote:
> >
> > Thanks Kevin.
> >
> > PCLKSEL0 register as the same value in both situations.
> > I'm using match 0 interruption, and timer 0 clock equal to 120MHz.
> > I'm setting interruption time to 1ms.
> >
> > I use UART 0 for debug and to change application parameters.
> > When the problem occurs the first debug messages that I send are lost
> > because trash is send.
> > I send debug messages imediatly after UART 0 initialization.
> > But this problem doesn't occur every time a reset occurs.
> >
> > Rui
>


Memfault Beyond the Launch