cancel
Showing results for 
Search instead for 
Did you mean: 

USB VirtualComPort Loopback

Ivan
Associate II
Posted on May 14, 2013 at 14:04

Dear collegues,

I experience a trouble with writing code for STM32L152VBT. Let me explain sequentially.

I had my PCB with chip STM32L152VBT.

I took the example project from STM32_USB-FS-Device_Lib_V4.0.0 and adopt to my chip. Run the project. Everything work perfectly. OK.

Because I planned to use USB loader, I corrected memory boundaries with agreement UM0424 (USB-FS-Device development kit): ROM start from 0x08003000 and add line in my code:

NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x3000);

Compile the project. It seems everything OK.

As soon I had added my code, the program crashed. Sometimes it stopped at adress below 0x08003000. Sometimes chip couldn't be stopped at all!

I have no idea what to do.

What is the trouble? In which direction should I dig? Help!

Best regards,

Ivan Z.

#usb #virtualcomport
3 REPLIES 3
Posted on May 14, 2013 at 15:47

Around here we break out the debugger and go fishing.

If it break because you change the vector table address, then perhaps you should assume you still have a couple of interrupts enabled for which your new table does not have service routines for?  Getting hard faults, use a proper handle to decompose the failure state.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Ivan
Associate II
Posted on May 15, 2013 at 09:28

Clive,

Thank for fast responce!

I checked it the first of all. I don't get ''Hardware fault interrupt''. I am about to rewrite program.

It is very similar to troubles with a vector table. But I can't catch error. =(

And I don't know why the MassStorageDevice worked perfectly in the same case. :((

Others ideas, methods, hypothesises?

Ivan
Associate II
Posted on May 15, 2013 at 10:30

I FOUND

The function Leave_LowPowerMode(void) in hw_config.c called SystemInit() (what for?), where vector table was reset back to default state. (VECT_TAB_OFFSET was 0). I corrected line

#define VECT_TAB_OFFSET 0x3000

And everything run! Thank you very much! 😉