EmbeddedRelated.com
Forums
Memfault Beyond the Launch

LPCUSB stack problem for VCP

Started by Nader March 4, 2008
Hi,
I use LPCUSB stack last version for VCP with LPC2148 OLIMEX board
in IAR 4.41a. Windows XP can detect it well and it knows it as COMx in
device manager. The example code is only echo the receive char:

while (1) {
c = VCOM_getchar();
if (c != EOF) {
// show on console
if ((c==9)||(c=)||(c=)||((c>2)&&(c<6)))
DBG("%c", c);
else
DBG(".");
VCOM_putchar(c);
}
}
But if I don't put any extra dalay in main while loop as shown below
any serial terminal in XP can't get/sent any character,but the device
manager know my device yet.putting delay cause the terminal sent and
get char
from this Virtual COm.

while (1) {
c = VCOM_getchar();
if (c != EOF) {
// show on console
if ((c==9)||(c=)||(c=)||((c>2)&&(c<6)))
DBG("%c", c);
else
DBG(".");
VCOM_putchar(c);
}
delayms(10);
}

Can this problem cause by MAM.2 issue in errata or something else
make it?

Thanks for help.

An Engineer's Guide to the LPC2100 Series

I find that problem is for limit stack for IRQ.before I increase
stack there are 1024 bytes for CSTACK and 256 bytes for IRQSTACK as
LPCUSB project set.I set 1024 for IRQSTACK and the code work well.
but before increase when I test my stack usage in IAR debugger with
256 bytes, I don't see any ovrrun of stack(it use only %40).
can anyone exaplain it or tell me exact needed for stack for LPCUSB
VCP?
Thasks.
--- In l..., "Nader" wrote:
> Hi,
> I use LPCUSB stack last version for VCP with LPC2148 OLIMEX board
> in IAR 4.41a. Windows XP can detect it well and it knows it as COMx
in
> device manager. The example code is only echo the receive char:
>
> while (1) {
> c = VCOM_getchar();
> if (c != EOF) {
> // show on console
> if ((c==9)||(c=)||(c=)||((c>2)&&(c<6)))
> DBG("%c", c);
> else
> DBG(".");
> VCOM_putchar(c);
> }
> }
> But if I don't put any extra dalay in main while loop as shown below
> any serial terminal in XP can't get/sent any character,but the
device
> manager know my device yet.putting delay cause the terminal sent
and
> get char
> from this Virtual COm.
>
> while (1) {
> c = VCOM_getchar();
> if (c != EOF) {
> // show on console
> if ((c==9)||(c=)||(c=)||((c>2)&&(c<6)))
> DBG("%c", c);
> else
> DBG(".");
> VCOM_putchar(c);
> }
> delayms(10);
> }
>
> Can this problem cause by MAM.2 issue in errata or something else
> make it?
>
> Thanks for help.
>
with -D_IRQ_STACK_SIZE0 in my flash.xcl linker file I got to
__prefetch_handler.
but with -D_IRQ_STACK_SIZE 0 the code work. I know 256 b enough for
LPCUSB stck for IRQ, but why my code will crash with this size of stack?

--- In l..., "Nader" wrote:
>
> I find that problem is for limit stack for IRQ.before I increase
> stack there are 1024 bytes for CSTACK and 256 bytes for IRQSTACK as
> LPCUSB project set.I set 1024 for IRQSTACK and the code work well.
> but before increase when I test my stack usage in IAR debugger with
> 256 bytes, I don't see any ovrrun of stack(it use only %40).
> can anyone exaplain it or tell me exact needed for stack for LPCUSB
> VCP?
> Thasks.
> --- In l..., "Nader" wrote:
> >
> >
> > Hi,
> > I use LPCUSB stack last version for VCP with LPC2148 OLIMEX board
> > in IAR 4.41a. Windows XP can detect it well and it knows it as COMx
> in
> > device manager. The example code is only echo the receive char:
> >
> > while (1) {
> > c = VCOM_getchar();
> > if (c != EOF) {
> > // show on console
> > if ((c==9)||(c=)||(c=)||((c>2)&&(c<6)))
> > DBG("%c", c);
> > else
> > DBG(".");
> > VCOM_putchar(c);
> > }
> > }
> > But if I don't put any extra dalay in main while loop as shown below
> > any serial terminal in XP can't get/sent any character,but the
> device
> > manager know my device yet.putting delay cause the terminal sent
> and
> > get char
> > from this Virtual COm.
> >
> > while (1) {
> > c = VCOM_getchar();
> > if (c != EOF) {
> > // show on console
> > if ((c==9)||(c=)||(c=)||((c>2)&&(c<6)))
> > DBG("%c", c);
> > else
> > DBG(".");
> > VCOM_putchar(c);
> > }
> > delayms(10);
> > }
> >
> > Can this problem cause by MAM.2 issue in errata or something else
> > make it?
> >
> > Thanks for help.
>

Memfault Beyond the Launch