Page 1 of 1

Serial over USB - chnWrite

Posted: Sat Mar 26, 2016 9:46 pm
by Methanbombe
Hello,

This is my first post on this Forum and i'm not that experienced with MC-Programming, so please be gentle.

My setup is: - STM32F4 Discovery
- ChibiStudio with Kernel Version 3.1.3

I am trying to implement a Virtual Com Port via Serial over USB, so I can log what's happening on my board.
So far I have orientated myself by the USB CDC - Demo.

The USB connection does work properly, as far as i can tell.

I however have a Problem when I try to write something to the ChannelObject of my SerialUSBDriver.

Code: Select all

static uint8_t buf[] = "Hello World!\n";
chnWrite(&SDU1, buf, sizeof buf - 1);


The system always goes into vectors.c:

Code: Select all

void _unhandled_exception(void) {
/*lint -restore*/

  while (true) {
  }
}


Same happens when I use chprintf(), there comes this unhandled exception when streamPut is called.
As far as I understand it, these Macros should call the Function Implementations in serial_usb.c, is that right?
I have set a Breakpoint in these functions, but the exception comes before the function is called.

How can I find out where this unhandled exception comes from?
Also am I doing something fundamentally wrong?

Any answers are appreciated.
Happy Easter to everyone,

Methanbombe

Re: Serial over USB - chnWrite

Posted: Sat Mar 26, 2016 10:25 pm
by Giovanni
Hi,

Is the SDU1 object initialized? see sduObjectInit() and the various USB demos. The exception is probably caused by the vmt pointer being NULL.

Giovanni