EmbeddedRelated.com
Forums
Memfault Beyond the Launch

UART Problem

Started by SoneR September 19, 2009
Hi,

I am using MSP2370 and I am experiencing a UART problem...

After initializations the code runs in an infinite loop, as it is
expected... Interestingly, while debugging, if I put a breakpoint just
before the infinite loop, RX-TX communication works perfectly, however if I
debug without breakpoint, the code does not come into ISR and it cannot
recieve any data - if I apply power to the system without debugging the same
problem is observed -

I tried different baud rates (From 9600 to 115200) and different clk
frequencies(From 3.39MHz to 13.56MHz) but I faced almost the same problem.

Which conditions obstructs the reader to enter interrupt?

Thank you...

--
Soner ISIKSAL


Beginning Microcontrollers with the MSP430

It seems that you forgot to enable the interrupts, and the debugger
(somehow) did it for you.
-Augusto
On Sáb 19/09/09 08:05 , SoneR s...@gmail.com sent:
Hi,
I am using MSP2370 and I am experiencing a UART problem...
After initializations the code runs in an infinite loop, as it is
expected... Interestingly, while debugging, if I put a breakpoint
just
before the infinite loop, RX-TX communication works perfectly,
however if I
debug without breakpoint, the code does not come into ISR and it
cannot
recieve any data - if I apply power to the system without debugging
the same
problem is observed -
I tried different baud rates (From 9600 to 115200) and different
clk
frequencies(From 3.39MHz to 13.56MHz) but I faced almost the same
problem.
Which conditions obstructs the reader to enter interrupt?
Thank you...
--
Soner ISIKSAL




Sounds like the "debugger" made the bug disappear.
But in other occasions, the "debugger" actually introducing bugs.

Is the "debugger" such an intrusive observer?

http://en.wikipedia.org/wiki/Observer_effect_(information_technology)

--- In m..., Augusto Einsfeldt wrote:
>
> It seems that you forgot to enable the interrupts, and the debugger
> (somehow) did it for you.
> -Augusto
> On Sáb 19/09/09 08:05 , SoneR soner86@... sent:
> Hi,
> I am using MSP2370 and I am experiencing a UART problem...
> After initializations the code runs in an infinite loop, as it is
> expected... Interestingly, while debugging, if I put a breakpoint
> just
> before the infinite loop, RX-TX communication works perfectly,
> however if I
> debug without breakpoint, the code does not come into ISR and it
> cannot
> recieve any data - if I apply power to the system without debugging
> the same
> problem is observed -
> I tried different baud rates (From 9600 to 115200) and different
> clk
> frequencies(From 3.39MHz to 13.56MHz) but I faced almost the same
> problem.
> Which conditions obstructs the reader to enter interrupt?
> Thank you...
> --
> Soner ISIKSAL
>
>
>
>
>
>
Instead of using a “debugger”, an alternative is to read the code. Reading the code carefully is the least intrusive way to find bugs.

--- In m..., "old_cow_yellow" wrote:
>
> Sounds like the "debugger" made the bug disappear.
> But in other occasions, the "debugger" actually introducing bugs.
>
> Is the "debugger" such an intrusive observer?
>
> http://en.wikipedia.org/wiki/Observer_effect_(information_technology)
>
> --- In m..., Augusto Einsfeldt wrote:
> >
> > It seems that you forgot to enable the interrupts, and the debugger
> > (somehow) did it for you.
> > -Augusto
> > On Sáb 19/09/09 08:05 , SoneR soner86@ sent:
> > Hi,
> > I am using MSP2370 and I am experiencing a UART problem...
> > After initializations the code runs in an infinite loop, as it is
> > expected... Interestingly, while debugging, if I put a breakpoint
> > just
> > before the infinite loop, RX-TX communication works perfectly,
> > however if I
> > debug without breakpoint, the code does not come into ISR and it
> > cannot
> > recieve any data - if I apply power to the system without debugging
> > the same
> > problem is observed -
> > I tried different baud rates (From 9600 to 115200) and different
> > clk
> > frequencies(From 3.39MHz to 13.56MHz) but I faced almost the same
> > problem.
> > Which conditions obstructs the reader to enter interrupt?
> > Thank you...
> > --
> > Soner ISIKSAL
> >
> >
> >
> >
> >
>


Yes, but read not allways mean understand. This is, actually, a good
effect of writing programs in Assembly: it only works when you know
what you are doing...
Back to the issue, I wonder if breakpoints in the debuug hardware
would actualy be non "public" documented interrupts with constant
vectors. This would make GIE=1 mandatory when a breakpoint is
inserted. Of course, it would mean an intrusive debugging channel.
Changing GIE state can also be a flaw in the debugger software. It is
interesting to note that I have done some assembly project debugging
and even after I disabled the interrupts (to check the number of
instructions used in a subroutine) the debugger still stoped in Timer
interrupts. So, to accomplish my task I had to modify the software and
disable the peripheral interrupt instead of just the GIE.
I never went deep in this issue because I would not waste time when
I know a workaround during a debugg session.
-Augusto
On Sáb 19/09/09 11:33 , "old_cow_yellow" o...@yahoo.com
sent:
Instead of using a âdebuggerâ, an alternative is to read
the code. Reading the code carefully is the least intrusive way to
find bugs.
--- In m..., "old_cow_yellow"

...> wrote:
>
> Sounds like the "debugger" made the bug disappear.
> But in other occasions, the "debugger" actually introducing bugs.
>
> Is the "debugger" such an intrusive observer?
>
> http://en.wikipedia.org/wiki/Observer_effect_
[1](information_technology)
>
> --- In m..., Augusto Einsfeldt wrote:
> >
> > It seems that you forgot to enable the interrupts, and the
debugger
> > (somehow) did it for you.
> > -Augusto
> > On Sáb 19/09/09 08:05 , SoneR soner86@ sent:
> > Hi,
> > I am using MSP2370 and I am experiencing a UART problem...
> > After initializations the code runs in an infinite loop, as it
is
> > expected... Interestingly, while debugging, if I put a
breakpoint
> > just
> > before the infinite loop, RX-TX communication works perfectly,
> > however if I
> > debug without breakpoint, the code does not come into ISR and
it
> > cannot
> > recieve any data - if I apply power to the system without
debugging
> > the same
> > problem is observed -
> > I tried different baud rates (From 9600 to 115200) and
different
> > clk
> > frequencies(From 3.39MHz to 13.56MHz) but I faced almost the
same
> > problem.
> > Which conditions obstructs the reader to enter interrupt?
> > Thank you...
> > --
> > Soner ISIKSAL
> >
> >
> >
> >
> >
> >
>



Hi again,
Now I'm sure that the problem is not related with the interrupt enable or
debugger amelioration of bugs.

UART module is getting its clk from ACLK. Here is the problem:

case1 : if I set MCLK = ACLK = 6.78MHz , BAUD = 115200, UART module works
properly.

case2 : if I set MCLK = 13.56MHz, ACLK = MCLK / 2 = 6.78MHz, BAUD = 115200,
UART module does not work. It does not enter ISR under some conditions
(related with the data I am sending) and the dada transmitted from MCU is
not decoded perfectly ( I see meaningless characters on the computer). It
looks like a BAUD rate problem.

Note : ACLK is used by Timer Module too but this shouldn't affect UART
module.

Why do I observe different responses although the frequency of UART module
is the same in both conditions.

Thank you for your interest...


Hi SoneR,

we had some days the same problem, that the baud-rate seams to be
varying more than
allowed. The reason was that a communication signal was near the crystal
and shift the
frequency of that crystal. The working of the code wasn't effected
because it was more
tolerant but the data sent via UART were nonsens.

Because the ACLK came from another source it works.

Hope this helps,

Dirk

SoneR schrieb:
>
>
> Hi again,
>
> Now I'm sure that the problem is not related with the interrupt enable or
> debugger amelioration of bugs.
>
> UART module is getting its clk from ACLK. Here is the problem:
>
> case1 : if I set MCLK = ACLK = 6.78MHz , BAUD = 115200, UART module works
> properly.
>
> case2 : if I set MCLK = 13.56MHz, ACLK = MCLK / 2 = 6.78MHz, BAUD > 115200,
> UART module does not work. It does not enter ISR under some conditions
> (related with the data I am sending) and the dada transmitted from MCU is
> not decoded perfectly ( I see meaningless characters on the computer). It
> looks like a BAUD rate problem.
>
> Note : ACLK is used by Timer Module too but this shouldn't affect UART
> module.
>
> Why do I observe different responses although the frequency of UART module
> is the same in both conditions.
>
> Thank you for your interest...
>
>

--
Ingenieurbo Dirk Rapp
Hard- & Softwareentwicklung

Adelhauser Str. 36
79585 Steinen

Tel.: +49 7627 923494
Mobil: +49 173 6686246

Thank you,

I must carry out some basic experiments to be sure whether the problem is
related with the one you specified.

Thank you again...

--
Soner Işıksal
+90 554 7363433



Memfault Beyond the Launch