cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F3 + GPS

grega
Associate II
Posted on February 03, 2014 at 10:43

Hello everyone,

I am the new one at programming stm32f3. I saw multiple examples here on the forum but I did not find what I want.

I have stm32f3 discovery board and ublox GPS connected to PD8 (Tx) and PD9 (Rx) pins. I want to read data from pins and show it on pc on terminal. I have connected stm32f3 discovery to PC via USB. For programming I use Keil uVision. Has anybody of you some code for this or can help me how to do that please?

Please help.

Best regards

Grega

#nmea #c-basics #parser #fsm #design #state-machine #c-learning
28 REPLIES 28
chen
Associate II
Posted on February 03, 2014 at 13:59

Hi

''I have connected stm32f3 discovery to PC via USB.''

So, does that mean you have the USB CDC device example working?

''I have stm32f3 discovery board and ublox GPS connected to PD8 (Tx) and PD9 (Rx) pins. I want to read data from pins and show it on pc on terminal.''

1st be careful. Check if the Ublox serial is RS232 voltage level, the STM32 usart is not RS232 voltage level (it needs a Max232 converter).

2nd - Ublox GPS has a pripriatry serial comm protocol or it can talk the standard NEMA protocol. When I worked on it, I did not find any free NEMA protocol parsers so you may have to write it. Ublox will provide the protocol information to decode their serial protocol. You can find the NEMA protocol standard somewhere on the internet.

Depending on what info you want from GPS, you request the right info. It can either continuously post info or you can poll it. Decode it and then send to the USB CDC.

grega
Associate II
Posted on February 03, 2014 at 14:22

Hi,

Yes, USB CDC device example working ok.

This is my connection between stm32f3discovery and ublox gps. I am using stm32f3 discovery shield. There is a picture in attachment. http://tinypic.com/r/29wk0gl/8

If I connect the GPS module with PC via usb, I can view in U-center program this type of data:

??:??:?? $GPRMC,,V,,,,,,,,,,N*53

??:??:?? $GPVTG,,,,,,,,,N*30

??:??:?? $GPGGA,,,,,,0,00,99,,,,,,*48

??:??:?? $GPGSA,A,1,,,,,,,,,,,,,99,99,99*30

??:??:?? $GPGSV,1,1,00*79

??:??:?? $GPGLL,,,,,,V,N*64

??:??:?? $GPGST,,0.0000,,,,3750000,3750000,3750000*78

??:??:?? $GPZDA,,,,,00,00*48

Is this NMEA protocol standard?

I want to read this data with my stm32f3discovery and then show this data on PC terminal...what can I do? please help

My question is: how can I get data from pins (where is connected GPS)? This pins are PD8 (Tx) and PD9 (Rx). I do not know how to code this in keil.

________________

Attachments :

stm_gps.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0Ob&d=%2Fa%2F0X0000000be7%2FkHuo_i0ukc8g0QyMTAD6zlKmEGfKboQgg87K_Dpv8M8&asPdf=false
Posted on February 03, 2014 at 15:40

You board appears to have it's own USB-to-serial connectivity, one method might be to configure the USART on the F3 for the GPS and USB-to-Serial, and then copy the data between the two. Alternatively you'd want to look at the USB firmware examples for the F3-DISCO, and build a VCP (Virtural COM Port), and have that connect to the USART attached to the GPS.

You could look through the various F3 firmware libraries for examples, and the forum. I know I've posted examples here.

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/usart%20code&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=518]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2Fusart%20code&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=518
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
grega
Associate II
Posted on February 03, 2014 at 15:58

Thanks for the replies,

clive1, do you maybe have an example how to configure the USART on the F3 for the GPS and USB-to-Serial, and then copy the data between the two? It means that I must configure one USART configuration for GPS and one for USB-to-Serial...how can I copy data between this two? I am the amateur and I really need this so please help me.

chen
Associate II
Posted on February 03, 2014 at 18:05

Hi

''Is this NMEA protocol standard?''

No it does not look like it. NEMA is a standard which all GPS modules should talk.

I got my data from here :

http://www.gpsinformation.org/dale/nmea.htm

'' one method might be to configure the USART on the F3 for the GPS and USB-to-Serial, and then copy the data between the two.''

I had not considered doing it this way - definitely simpler to do this and then handle the decoding in the PC.

Posted on February 03, 2014 at 18:28

I am the amateur and I really need this so please help me.

Ok, so you're going to need to provide a cite for the board schematic so I don't have to go fishing for it.

Describe the pins used by the GPS, and the USB-to-USART chip, and the expected baud rates for the two of them.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
chen
Associate II
Posted on February 03, 2014 at 18:33

''how can I copy data between this two? I am the amateur and I really need this so please help me.''

If I remember correctly, the USB CDC example pretty much just copies the USB CDC data to the USART and visa versa. Take a look at the example.

grega
Associate II
Posted on February 03, 2014 at 18:44

@clive1

GPS board shematic:

http://www.mikroe.com/downloads/get/155/gps_click_manual_v100.pdf

STM32f3discovery shield shematic:

http://www.mikroe.com/downloads/get/2036/stm32f3_shield_user_manual.pdf

Baud rates for both are 9600

Pins: PD9(Rx) ->gps Tx, PD8 (Tx) ->gps Rx

Posted on February 03, 2014 at 18:56

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6di&d=%2Fa%2F0X0000000bsI%2FxsrX2rdYRScHdta8AKiRrTyNCtBNIP90bfuXD5nZMEg&asPdf=false
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..