STM32f3 + Virtual COM port + proprietary ST library

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

Moderator: RoccoMarco

Post Reply
chappy
Posts: 2
Joined: Thu Mar 20, 2014 12:04 pm

STM32f3 + Virtual COM port + proprietary ST library

Post by chappy »

Hello,
I'm quite newbie in RTOS and especially in ChibiOS. And I like the concept etc..
I'm trying to create Virtual COM port with proprietary ST peripheral drivers. Without the OS, the code is running correctly. But as soon as I add the code to a task and cal init of OS and HAL (just now, almost everything is dissabled and only hal_lld_init() is called).
So the issue is, that the SW runs for couple of second and than it jump to HardFaultVector. But until this happend, I can see that it work correctly. I can see new device (Virtual COM port) in Linux. Temporary I only commented out relocation of USB IRQ in (hal_lld_init). I don't see any association (ass plug in USB etc.)
Can anybody give me some hints?

main file: http://pastebin.com/NuU39Xre
st lib config: http://pastebin.com/t45gEqNR
hal_lld.c: http://pastebin.com/sPSvQ8L0

Thank you
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32f3 + Virtual COM port + proprietary ST library

Post by Giovanni »

A virtual com port is alredy implemented in ChibiOS, you don't need ST libraries. See the various demos under ./testhal.

In order to debug your problem I recommend you enable the debug options in chconf.h and see if something is triggered, most likely it is just a stack overflow.

Giovanni
chappy
Posts: 2
Joined: Thu Mar 20, 2014 12:04 pm

Re: STM32f3 + Virtual COM port + proprietary ST library

Post by chappy »

Hello Giovanni,
thank you for fast respond. I know about your HAL CDC. But I wanted to play little bit with ST lib.
anyway, I couldn't figured it out. Even with all debugging turn on. It jumped to hard HardFaultVector. I tried to encrease stack for thread and also increased PORT_IDLE_THREAD_STACK_SIZE and PORT_INT_REQUIRED_STACK in chcore_v7m.h. But without improvement.
So I took directly testhal\STM32F30x\USB_CDC project. And for this I recieve only couple of characters and it stuck in port_halt() function with msg "sv#8"

you can see whole stack:
#0 0x80004c2 port_halt() (../../../os/ports/GCC/ARMCMx/chcore.c:48)
#1 0x8000880 chDbgPanic() (../../../os/kernel/src/chdebug.c:274)
#2 ?? dbg_check_enter_isr () (../../../os/kernel/src/chdebug.c:166)
#3 0x8000576 SysTickVector() (../../../os/ports/GCC/ARMCMx/chcore_v7m.c:49)
#5 0x8000822 dbg_check_unlock_from_isr() (../../../os/kernel/src/chdebug.c:152)
#6 0x8008590 usb_packet_read_to_queue() (../../../os/hal/platforms/STM32/USBv1/usb_lld.c:183)
#7 ?? Vector16C () (../../../os/hal/platforms/STM32/USBv1/usb_lld.c:392)
#9 0x55555554 ?? () (??:??)
#10 0x55555554 ?? () (??:??)

Seems that CH_IRQ_PROLOGUE() doesnt work properly, does it? And I also don't understand 0x55555554 address. From datasheet it is in reserved area.

I'm thinking about different compiler. I use gcc-arm-none-eabi-4_7-2013q3 on Linux.
and ChibiOS version: ChibiOS-RT-stable_2.6.x.zip

Thank you.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32f3 + Virtual COM port + proprietary ST library

Post by Giovanni »

Hi,

#SV8 means that probably you have some IRQ set at a priority level above the kernel level (level 0 or 1 usually) so it is able to preempt the kernel and mess things up.

Giovanni
Post Reply