cancel
Showing results for 
Search instead for 
Did you mean: 

ADC with USB on STM32L

nanayakkaraan
Associate II
Posted on April 29, 2014 at 12:20

Hello,

I am trying to make send ADC data over the USB of STM32.

For the USB part I am using STM32 USB-FS-Device firmware library from ST.

In the samples given I see that in order to make USB work, USB pins are not configured in AF mode. Any clarifications on this.

Further when integrating my ADC functions with USB I am having some issues. Has anybody experience this kind of scenario earlier?

May be those who have work put ADC data on USB can provide me some guidance.

Thanks.

Anuradha.

#gpio_af_usb
5 REPLIES 5
os_kopernika
Associate II
Posted on April 29, 2014 at 12:56

//USB does not work without USB Alternate Function enabled. This part is missing in STM demo.
//Interestingly DP and DM GPIOs must NOT be configured in AF mode but in IN mode (reset default).
GPIO_PinAFConfig( GPIOA, GPIO_PinSource11,GPIO_AF_USB);
GPIO_PinAFConfig( GPIOA, GPIO_PinSource12,GPIO_AF_USB);

EDIT: ''

USB Alternate Function

'' instead of ''

Alternate Function

''.
nanayakkaraan
Associate II
Posted on April 29, 2014 at 13:21

Dear Brutte,

Thanks for replying. But I am confused. ''

//USB does not work without Alternate function enabled.''

This implies that I need to use,

GPIO_PinAFConfig( GPIOA, GPIO_PinSource11,GPIO_AF_USB);
GPIO_PinAFConfig( GPIOA, GPIO_PinSource12,GPIO_AF_USB);

Again it is said,
''DP and DM GPIOs must NOT be configured in AF mode but in IN mode (reset default).''
That meansPA11 and PA12 should be in IN mode.
Conflict.
Please clarify.
Thanks.
Anuradha

os_kopernika
Associate II
Posted on April 29, 2014 at 13:55

First comment line says that you HAVE TO set GPIOA_AFRH to respective

GPIO_AF_USB

mode. Second comment line says that you MUST NOT set GPIOA_MODER to alternate function. Leave it as input. Does not look contradictory to me. Of course the above does not say some other combination can not work. Only that this one does work. The ''USB AF Weirdness'' is not very intuitive, is it? EDIT: I have updated the comment in the above post.
nanayakkaraan
Associate II
Posted on May 02, 2014 at 11:52

Dear Brutte,

Thanks for the clarification.

Yes I got the point. The settings are for two distinct GPIO registers so there is no contradiction.

But unfortunately this configuration does not solve my problem... :(

Thank you..  !!

Anuradha.

sameh_ayari_ge
Associate
Posted on May 02, 2014 at 12:23

I am using STM32F407VG board to test the firmware project ''Audio_playback_and_record''found in  STM32F4-Discovery_FW_V1.1.0_STfrom internal flash.

The problem I had is the following:

1. When I choose I2S as current_interface, the wave file (inAudio_sample.c)  is played but with a delay.

2. When I select DAC as current_interface, I hear anothersound, which is different from the wave file.

Is  there any moreadjustments to do, other than choosing current_interface and internal flash?