This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

usb device on stm32L151RD

I have designed system based on STM32L151. It uses usb for powering/charging and communicating to laptop. My system uses Embedded File System (SPI, 8MB) without RTX, USB(CDC Class), given by ST.
I have typical problem and did not find any answer on net and from ST. As long I do not any request from PC on USB to system, things are OK, i.e. I can store and send the file from system to laptop on USB. But if I send any request from Laptop like configuration/reading of file etc, sending file to PC does not work. While digging, I found that lower level fopen function generate hard fault exception, hinting wrong memory access (data address invalid). It happens only when there is req from host, else device can send file without any problem to host by system keypad operation.
I suspect that when EP_OUT is called, it is damaging the RAM area, which used by fopen function, like file information etc. I am new to USB, much can not do myself. I have 2K Stack and 1K heap, no of files opened at a time are 2.
Is anybody, faced problem like this, if yes, how they solved.
Is there any simple example to handle similar case, I do not need serial handling in system.
Thanks in advance.

0