SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By durgesh777
#133719
I have programmed something in labview to access some data through usb port from stm primer2.

Now i am switching the whole program to olimex stmh103 board.

when i connect the usb port of the olimex board to pc, the red light is turned on which is the indication of power supply but i also want a communication through usb then should i also connect another power supply to extension header 2 at pin 25 and 26 (which are gnd and vin respectively).

I am not able to communicate through usb because labview program configures for the virtual com port and i should identify which com port i have connected. Normally if i connect usb port i can see on device manager but with olimex board i cannot see on the device manager. I can only see the connection if i conect jtag interface (or debugger) to olimex.
So how can i communicate to stm32 microcontroller available in olimex board through usb and that should be compatible to labview as well.
I look forward for suggestion and help.

Thanks in advance.
By hsutherl
#133801
Hello Durgesh,

I assume you're using the LabView embedded module for ARM. And I further assume that LabView can now create an entire application for the Primer, ready to download. Once the application has been "built", do you download it via the debug port, and then switch over to the STM32 port when running it?

I tried to look at the NI site but they make you sign in before providing even the most basic info (I was too lazy to dig out my password).

If the embedded module provides source code for the app, at least in theory you could study that, modify it for the Olimex board, then build it using whatever tools you're comfortable with. (Hint: the Primer comes with the Raisonance Ride development tools. Or, the LabView module may provide a hex file - no clue about that.) To get the code into the Olimex board, you could use OpenOCD (you mentioned a JTAG adapter). If you'd rather use flashmagic or the ST serial port downloader tool, you'd have to provide a level shifter since the stmh103 doesn't have one built in. At that point the Olimex board would presumably behave as a virtual COM port, and would talk to (the "running the app" part of) LabView.

A lot of work even if the source is available. If it isn't, then you're pretty much out of luck.

Your post is the first one I've seen here about LabView. I can't be sure but I suspect you'd get more response on the National Instruments board.

Good luck!

-Hugh
By durgesh777
#134056
Thank you Hugh,

I think either i put the question in other way or there was some misunderstanding in analysing the problem statement.
I have already programmed with primer 2 and for this i use Ride 7 which is the Raisonance (you v also mentioned the same in your answer). There is no problem in this case because i can debug do everything and transfer the data (or the information) from primer 2 to labview and implement my desired algorithm.

Now i m switching the same program for olimex stmh103 which has stm32f103rbt6 microcontroller. In fact the one in primer2 is a high density and the microcontroller in olimex is a medium density. I have modified everything in my program.

The problem is that i cannot transfer the data to the same labview program. Labview is ok and i believe there has to be no change. Also to mention i used VISA VI for the reception and transmission of data from and to stm32 through usb.

Precisely putting up my question, the previous program which was written in stm32 high density has different configuration, eg. usb pull up (or usbdisconnect pin) is different in primer2 and olimex board. So i have done following changes:
Convert pin D.9 into C.11 (all the associated codings). For this i modified in 'platform_config.h' header file and also in 'hw_config.c' files. To mention, these are the files included in the usb library available from stm manufacturer.

Now i would like to know what necessary changes should i do so that the communication (that was previosly working through primer2 and labview interface) would be possible.

Regards and thanks in advance.


hsutherl wrote:Hello Durgesh,

I assume you're using the LabView embedded module for ARM. And I further assume that LabView can now create an entire application for the Primer, ready to download. Once the application has been "built", do you download it via the debug port, and then switch over to the STM32 port when running it?

I tried to look at the NI site but they make you sign in before providing even the most basic info (I was too lazy to dig out my password).

If the embedded module provides source code for the app, at least in theory you could study that, modify it for the Olimex board, then build it using whatever tools you're comfortable with. (Hint: the Primer comes with the Raisonance Ride development tools. Or, the LabView module may provide a hex file - no clue about that.) To get the code into the Olimex board, you could use OpenOCD (you mentioned a JTAG adapter). If you'd rather use flashmagic or the ST serial port downloader tool, you'd have to provide a level shifter since the stmh103 doesn't have one built in. At that point the Olimex board would presumably behave as a virtual COM port, and would talk to (the "running the app" part of) LabView.

A lot of work even if the source is available. If it isn't, then you're pretty much out of luck.

Your post is the first one I've seen here about LabView. I can't be sure but I suspect you'd get more response on the National Instruments board.

Good luck!

-Hugh
By durgesh777
#134173
Dear Mr. Hugh,

I further have one more query if you could help me on this.
When i tried with NI VISA application to have the required ini file for the interfacing devices with USB, i require vendor id (VID) and product id (PID) of the device. I have no access to such numbers even though i connect the olimex board's USB communication port with my PC.
So how would my computer recognize the usb port at which i have connected olimex stmh103 board so that i can have communication between pc (in my case labview application) and microcontroller (STMF103RBT6)?
Also what should be written in microcontroller so as to activate the communication as soon as i insert the usb connecter of the olimex board to pc?

I look forward to hear from you.

Regards,
Durgesh
By hsutherl
#134205
Oh boy.

All the things I assumed were completely wrong. If you not only got the VCOM working yourself, but set up the Primer to function as a virtual NI instrument, you're already working at a level of complexity a couple of notches above anything I've done. Apologies for the lack of respect!

Aside from the usbdisconnect pin that you already mentioned, the only important difference I see between my Primer2 and the Olimex board is that the Primer2 has an external 12MHz oscillator, while the Olimex board has an 8MHz crystal connected to the STM32 oscillator pins. So in your startup config for the Olimex board you'd have to clear (or not set) the HSEBYP bit in the RCC_CR register, and your PLL multiplier would probably be 9 instead of 6.

I say my Primer2 because the usbdisconnect on my Primer2 is D.3 rather than D.9. If we have different flavors of Primer, the oscillator circuit might be different as well.

Regarding the vendor and product ID, I suggest during the debug stage you continue to use the values from the ST VCOM example.

I don't have an Olimex header board, but I tried a simple modification of the ST VCOM example on two budget (Chinese) boards as well as my Primer2, with just the differences mentioned above. Each worked ok with HyperTerminal. (Windows did report "new hardware found" for each one. I know there is a section of the VCOM code that reads the unique serial # of the STM32. Perhaps that is involved.)

This is well outside my area of expertise, but I know that if you use a different VID and / or PID, you'll have to supply a .inf file for use with windows. (I'm not clear on the equivalent process with Linux.) If you search the forum at ST.com (a slow and painful process) you'll find a thread where ST support says they're willing to supply a product ID for products using their chipset. The product would then have the ST VID and its own unique PID. But my impression was that they were talking about products for commercial production.

It sounds as if you based your application on the ST VCOM example? If so, the supplied code responds to interrupts generated by the USB hardware and takes care of all the enumeration. You should not need to add anything except the hooks you used with the Primer. (I'm still wading through the details myself; the app-specific code starts with stm32f10x_it.c, a lot of it is in usb_prop.c, and of course the bulk of the generic code is in the usb library.)

Best Regards,
-Hugh
By durgesh777
#134265
Dear Mr. Hugh,

I think i am near to the solution that i want. I have to thank you as well.
I found the Product Id and Vendor ID under 'usb_desc.c'.

Now before further proceeding i would like to ask about 'USB_P' in olimex board. This is connected to +5V_USB through resistors only when the jumper 'USBP_E' is connected. By default the jumper is connected (because of default soldering).
Now my question is for the case when i disconnect the jumper. I hope this pin 'USB_P' is only in olimex board and not a universal use with USB implementation and further i think it is only a facility provided by olimex to detect the 5V from the host.
So if i disconnect the jumper 'USBP_E' then will i be able to work normally with USB as usual and also in case when i work with CAN bus?

I thank you in advance.

Regards
By hsutherl
#134300
Ah. I hadn't noticed that circuit. Your analysis looks exactly correct to me. And the description of the jumper in the manual agrees with what you wrote.