Discussion:
USB on STM3240G-EVAL
(too old to reply)
duckdogster-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx]
2014-05-14 17:08:13 UTC
Permalink
I'm trying to enable the Prolific USB serial support on the STM3240G-EVAL board, and am getting a link error:
LD: nuttx
/home/me/nuttx/lib/libarch.a(up_initialize.o): In function `up_initialize':
u_initialize.c:(.text+0x24): undefined reference to `up_uspinitialize'
I can't find that symbol in the board code, finding instead, in up_usb.c, a similar function stm32_usbinitialize.


Also, that file up_usb.c isn't even getting built.


It looks like the USB support in the STM3240G was done differently than in, for example, the stm32f4discovery.


So, three questions:


1. It looks like I'm not configuring properly - any ideas what I'm doing wrong?
2. Does the STM3240G board port support using USB as a virtual serial port?
3. Any suggestions on how best to proceed?


Thanks!
spudarnia-/E1597aS9LQAvxtiuMwx3w@public.gmane.org [nuttx]
2014-05-14 18:06:04 UTC
Permalink
Post by duckdogster-***@public.gmane.org [nuttx]
u_initialize.c:(.text+0x24): undefined reference to `up_uspinitialize'
probably, 'up_initialize.c:(.text+0x24): undefined reference to `up_usbinitialize'
Post by duckdogster-***@public.gmane.org [nuttx]
I can't find that symbol in the board code, finding instead, in up_usb.c, a similar function stm32_usbinitialize.
up_usbinitialize is called in arch/arm/src/common/up_initialize.c. It is prototyped in arch/arm/src/common/up_internal.h and defined so that the call is made only if CONFIG_USBDEV.

#ifdef CONFIG_USBDEV
void up_usbinitialize(void);
void up_usbuninitialize(void);
#else
# define up_usbinitialize()
# define up_usbuninitialize()
#endif

USB support for the STM32 is provided in arch/arm/src/stm32/stm32_otgfsdev.c or arch/arm/src/stm32/stm32_usbdev.c, depending upon which part that you use:

arch/arm/src/stm32/stm32_otgfsdev.c:void up_usbinitialize(void)
arch/arm/src/stm32/stm32_usbdev.c:void up_usbinitialize(void)

These are selected in arch/arm/src/stm32/Make.defs:

ifeq ($(CONFIG_USBDEV),y)
ifeq ($(CONFIG_STM32_USB),y)
CHIP_CSRCS += stm32_usbdev.c
endif
ifeq ($(CONFIG_STM32_OTGFS),y)
CHIP_CSRCS += stm32_otgfsdev.c
endif
ifeq ($(CONFIG_STM32_OTGFS2),y)
CHIP_CSRCS += stm32_otgfsdev.c
endif
endif

So I would conclude that probably defined CONFIG_USBDEV but none of CONFIG_STM32_USB, CONFIG_STM32_OTGFS, or CONFIG_STM32_OTGFS2. That is, you requested to build in USB device support but did not select a device controller driver.
Post by duckdogster-***@public.gmane.org [nuttx]
Also, that file up_usb.c isn't even getting built.
Similarly, in configs/stm3240g-eval/src/Makefile:

ifeq ($(CONFIG_STM32_OTGFS),y)
CSRCS += up_usb.c
endif
Post by duckdogster-***@public.gmane.org [nuttx]
1. It looks like I'm not configuring properly - any ideas what I'm doing wrong?
You are not selecting CONFIG_STM32_OTGFS=y
Post by duckdogster-***@public.gmane.org [nuttx]
2. Does the STM3240G board port support using USB as a virtual serial port?
Yes, you just need to add the CDC/ACM class to the build via 'make menuconfig'. There is a lot of discussion on how to do this for other boards, but not for the STM3240G-EVAL. Look at:

$ grep CDCACM configs/*/README.txt

These, in particualar, are probably instructions for STM32 boards:

hymini-stm32v/README.txt: CONFIG_CDCACM=y
mikroe-stm32f4/README.txt: CONFIG_CDCACM=y
stm3210e-eval/README.txt: +CONFIG_CDCACM=y
stm32_tiny/README.txt: CONFIG_CDCACM=y
stm32f3discovery/README.txt: CONFIG_CDCACM=
stm32f429i-disco/README.txt: CONFIG_CDCACM=y
stm32f4discovery/README.txt: CONFIG_CDCACM=y
viewtool-stm32f107/README.txt: CONFIG_CDCACM=y
Post by duckdogster-***@public.gmane.org [nuttx]
3. Any suggestions on how best to proceed?
I think that you just need to add CONFIG_STM32_OTGFS=y to your configuration. I don't see any other issue.

Greg
duckdogster-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [nuttx]
2014-05-14 21:41:45 UTC
Permalink
Hi Greg,


Yeah, up_initialize() - sorry for the typo.

Yes, CONFIG_STM32_OTGFS=y was missing, and adding it fixed the error. Now everything compiles and links.


It looks like the CDC/ACM hasn't been added to the STM3240G-EVAL. So I gather that is my next task, eh?


Thanks for your help!


Bob
spudarnia-/E1597aS9LQAvxtiuMwx3w@public.gmane.org [nuttx]
2014-05-14 21:55:25 UTC
Permalink
Hi, Bob,
Post by duckdogster-***@public.gmane.org [nuttx]
It looks like the CDC/ACM hasn't been added to the STM3240G-EVAL. So I gather that is my next task, eh?
NuttX is very configurable. My objective is to check in only basic "vanilla" configurations in the NuttX repository. if you want additional features, like CDC/ACM, you need to do that through 'make menuconfig'. That should be the standard procedure.

Assuming that you already have USB device enabled, you have read the instructions for the other platforms that I recommended, and you are generally familiar with configuration menu organization, enabling CDC/ACM should be a trivial, 30 second exercise.

Greg
rgrimes-G1S0SiIrPljQT0dZR+AlfA@public.gmane.org [nuttx]
2014-05-15 12:31:13 UTC
Permalink
Hi Greg,

I appreciate and agree fully with your points in the first paragraph. My only issues with that is getting the configuration to compile, and by this I mean only getting myself up to speed - i.e. the old newbie learning curve. So thanks for your patience.


I looked through what you've provided, and while it compiles, it doesn't appear to be working - the device doesn't show up when I plug it in to my computer. That said, I'm shelving this for now, as getting IAR tools working seems more important to the powers that be.


Regards,
Bob
spudarnia-/E1597aS9LQAvxtiuMwx3w@public.gmane.org [nuttx]
2014-05-15 14:13:16 UTC
Permalink
Hi, Bob,
Post by rgrimes-G1S0SiIrPljQT0dZR+***@public.gmane.org [nuttx]
I looked through what you've provided, and while it compiles, it doesn't appear to be working - the
device doesn't show up when I plug it in to my computer. ...
I don't know what platform that you are using, but the host should at least attempt to enumerate the device if you have a pull-up on the data line. Most, newer MCUs include the pull-up internally (some older MCUs like the STM32 F103 require that you have external circuitry to enable the pull-up).

If you are using Windows as the host, then you should at least get the unhappy sound and it should show an unrecognized device in the Device Manager. If so, then you may just have a device problem. On windows, you must provide a driver (.inf file) to support CDC/ACM.

On Linux, 'dmesg' should give you a pretty good idea if anything happened. If nothing happened then certainly it is an issue with the pull-up.

When working with USB, you almost always need a USB analyzer to understand what is really happening.
Post by rgrimes-G1S0SiIrPljQT0dZR+***@public.gmane.org [nuttx]
... That said, I'm shelving this for now, as getting IAR tools working seems more important to the
powers that be.
Good luck! If I had the IAR toolchain, I would be happy to help you with this.

Greg

Continue reading on narkive:
Loading...