Help with BasicUSB demo application please

Guest #1171854
I've got Martin Thomas' BasicUSB demo working in "mode 1", where data on
the SAM7S UART is passed over USB to a "virtual" COM port on the host
and vice versa.

I'm trying to send characters to the virtual COM port independant of the
SAM7 UART (in order to use the virtual port as a debug interface).  That
is, I just need a "virtual_printk()" function that outputs a string over
USB to the virtual COM port.

I thought I could just use the pCDC.Write() function, but this only
outputs the string when characters are typed in at a terminal connected
to the virtual port. There is something going on with the interupts that
I don't understand.

Can someone please tell me what is preventing the data from being
written directly to the virtal COM port?

Thanks,  - Joe

while (1)
   {
  // Check enumeration
  if (pCDC.IsConfigured(&pCDC))
        {

          // Send string to virtual COM port (not working)
          // testdata only sent when character entered
          // at virtual COM port terminal application.
          pCDC.Write(&pCDC, testdata, strlen(testdata) );

    length = pCDC.Read(&pCDC, data, MSG_SIZE);
    data[length]=0;
    Trace_Toggel_LED( LED1) ;
          AT91F_US_Put(data);

  }
#1171855
jdupre wrote:
> Can someone please tell me what is preventing the data from being
> written directly to the virtal COM port?

OK, my bad.  I didn't realize that pCDC.Read() was waiting for data.
That is why the Write function wouldn't write until a key was pressed
(to get out of the Read function)...

- J

Reply

A question of your own? This thread is over 20 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.