Serial over USB - chnWrite Topic is solved

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
Methanbombe
Posts: 8
Joined: Sat Mar 26, 2016 9:07 pm

Serial over USB - chnWrite

Post 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
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Serial over USB - chnWrite

Post 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
Post Reply