0
\$\begingroup\$

I try to implement a VCP on a STM32F105RB with the STM32_USB-Host-Device_Lib_V2.2.0

I was able to compile the Code sucessfully.

My Hardwareconfiguration is the following:

Mini USB directly (without series resistors) to D+ and D- of the STM32. +3.3V to PA9 (for BusSensing)

After debugging start in atollic, the host detects a new device but it is not listed in the device manager.

After few seconds, i get a BusFault on the STM. The BFARVALID is set and the BFAR is 0x1FFF 7A10

This is interessting, since the Addressspace between 0x0804 0000 - 0x1FFF AFFF is reserved.

If i restart the firmware 2-3 times (NOT the debugging process, only do a soft reset not a hard reset) and click run again, then it detects the VCP correctly after some tries. It shows a not working COM9 and a working COM10 in the device manager. And it does not end up in the bus fault anymore.

Can anybody help me solve this problem?

Thanks

Attached are the Registers at BusFault and the Dissassembly.

Memory MAP

Registers at BusFault

Dissasembly of the RAM Address

Dissassembly of the SP Address

CFSR Register at BusFault

MMFAR Register at BusFault

Update:

Layout: Layout of the Breakoutboard

Schematic: Schematic

Documentation: Link

For VBUS-Sensing, i have connected PA9 with +3.3V. My board is powered through USB. So as soon as i plug in the USB-Cable, the board get its power and as soon as 3.3V is up, VBUS-Sense (PA9) is also high.

\$\endgroup\$
  • \$\begingroup\$ Could be a problem with your PCB layout, causing glitches on the voltage lines (VCC). Schematic and layout could be helpful... \$\endgroup\$ – Turbo J Jan 7 '18 at 12:40
  • \$\begingroup\$ Thanks for your comment. Here is the docu (unfortunately in german) of the board: blselectronics.ch/wp-content/uploads/2016/05/… I added the Schematic and layout to the post \$\endgroup\$ – C. Hediger Jan 7 '18 at 12:54
2
\$\begingroup\$

I found the problem.

It was in the file: usbd_desc.h

i missed to define the correct board. So it tried to get the Device ID from a wrong address. -> BUS FAULT

How did i found the problem?

I looked at the stackpointer at 0x2000fedc and saw the address 0x8004196 this was the following c-code section:

static void Get_SerialNum(void)
{
  uint32_t deviceserial0, deviceserial1, deviceserial2;

  deviceserial0 = *(uint32_t*)DEVICE_ID1;
  deviceserial1 = *(uint32_t*)DEVICE_ID2;
  deviceserial2 = *(uint32_t*)DEVICE_ID3;
  ...

Now i dived deeper and saw that DEVICE_ID1,2,3 pointed to a wrong address. I fixed it and now it works!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.