USB serial parameters?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

USB serial parameters?

Post by russian »

What is the connection configuration of the USB virtual serial?

I have compiled the 407_discovery_mems demo, Windows does see a Virtual Com port, I've installed the driver - still, I do not see anything when I connect to the COM port with putty. I've tried 38400-8-N-1, 57600 and 115200

I'm shaking the board as crazy & hitting the user button - but still nothing in the console :( Same console worked with the USART dongle
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB serial parameters?

Post by Giovanni »

The communication parameters are irrelevant, you should see a shell on the com port. Press enter to get a prompt or you will see nothing.

Giovanni
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: USB serial parameters?

Post by Tectu »

I just tried both, the F4-DISCOVERY as well as the F4-DISCOVERY-MEMS demo yesterday myself and I couldn't get a VCOM port on my linux machine as well. Before I did that, I updated to the latest master of the ChibiOS/RT repository. Other demos like the OLIMEX_E407 did work very well in the past.


~ Tectu
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB serial parameters?

Post by Giovanni »

I tested F4-DISCOVERY-MEMS, it works on Win-XP. I cannot test on Linux but it is unlikely to be a driver issue, it appears to be host OS related.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: USB serial parameters?

Post by russian »

OMG, I am really bad! I've hit enter and now I do see the shell!
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: USB serial parameters?

Post by russian »

This USB serial seems to be quite fragile?

1) I have modified the demo to print a hello message right after 'SDU1.config->usbp->state == USB_ACTIVE' check - but the channel is not ready as is. By the way I have not seen the stock 'ChibiOS/RT Shell' message till I have inserted a 6 (!!!) seconds delay. Bad, but I can live with that

2) I cannot re-connect to the USB serial if I hit the 'reset' button on the dev board (again, it's stm32f4discovery).
So, my action sequence:
a) I launch my .bat file to upload fresh binary, it also does MCU reset. the com port disappears and re-appears in the Device Manager
b) i connect to COM21 via putty, 6 seconds later I see my welcome message (no enter is needed)
c) I hit the 'reset' button on the dev board. the com port disappears and re-appears in the Device Manager, but my attempts to connect to it via putty fail with a 'failed to connect' message
d) I unplug and re-plug the microusb cable and get the shell running
That makes this unusable for me :(

I use WinXP & Chibi 2.5.1
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB serial parameters?

Post by Giovanni »

It is not matter of fragility. The problem is that there is no way to know if the host is ready for receiving data after enumeration. UAB_ACTIVE only tells you that the device has been enumerated but not that an application is ready on the other side to receive data.

You may wait for the host side to send a message through the port before beginning.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: USB serial parameters?

Post by russian »

What about the inability to connect via the USB after I hit reset button on the board without unplugging the cable?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB serial parameters?

Post by Giovanni »

It works here, after a reset the discovery-mems demo is removed as a device and re-enumerated after one second. There is specific code in the main:

Code: Select all

  /*
   * Activates the USB driver and then the USB bus pull-up on D+.
   * Note, a delay is inserted in order to not have to disconnect the cable
   * after a reset.
   */
  usbDisconnectBus(serusbcfg.usbp);
  chThdSleepMilliseconds(1000);
  usbStart(serusbcfg.usbp, &usbcfg);
  usbConnectBus(serusbcfg.usbp);


Not sure about the cause of your problem.

Giovanni
Post Reply