2018-03-28 05:14 AM
Hi,
I am newbie to this STM32L4 Controller. I am working on GPS device to get the location of the location and i am using the CubeMax and Keil software for programming. As i have mention that i am newbie, I dont know how do I move forward.
I want to Learn the programming in Keil and with their HAL Drive and all. I am using the UART-2 in STM32L4 controller to communicate between the GPS and controller. Here I have used the UART HAL Driver for communication, but i properly dont know that how i should pass argument i that HAL driver function for communication.
So please share and guide for this UART Communication using HAL Driver in keil. And also share if their is any study material available for this.
I my code HALL function defined like this:
'HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);'
And i have pass the argument like this:
'HAL_UART_Transmit(&huart2 ,(uint8_t*)&buffer,20,1000); '
In buffer i have assigned the AT+QGPSCFG to send the AT command to communicate between the GPS and the Controller. If their is any problem in code please let me know.
Please share me the proper details for this.
Thanks
Sachin
2018-03-28 05:43 AM
Cross-posted here
http://www.keil.com/forum/63479/
>> If their is any problem in code please let me know.
You've showed a single line, you should perhaps be using strings, and only sending the actual length of the viable data rather than arbitrary length.
GPS receivers typically don't take AT commands, so presume you have a MODEM with a GPS connected. You need to automate the interaction, ie sending commands and parsing and processing responses.
A lot of this is basic programming rather than being Keil or STM32 specific. You should perhaps focus on general tutorials, and work through all the code examples under the STM32 HAL source trees. Lots of book available of programming, get comfortable with that.
This is a handler that collects whole GPS NMEA sentences and then passes them off. The USART typically receives a character at a time so you either need to accumulate multiple bytes, or use a state machine.
https://community.st.com/message/181151-implementing-interrupt-driven-stream-uart-rx-handling-on-l4
2018-03-28 10:33 AM
I am newbie to this STM32L4 Controller.
So do you have any prior experience with any other microcontroller(s) ?
Or with 'C' programming in general?
Did you study the learning resources suggested in your cross-post on the Keil forum?
2018-03-29 12:47 AM
Hi Andrew Neil,
Yes, I am experienced with the micro-controller as well as with C language.
Not yet, for now i am started to read the suggested resources from cross post.
2018-03-29 01:09 AM
2018-03-29 01:43 AM
I have read the AT commands for the GPS operation. They mention so many commands for the many operation like configuration, get location and many others also.
Are you sure you don't mix up things here ?
GPS modules don't take AT commands, they use the NMEA 183 standard (or the newer NMEA 2000).
And the have a default setting (baudrate, update rate, sentences sent), i.e. the work 'out of the box', without configuration.
I would suggest to concentrate on RX first, use these GPS default settings, and see if you get the sentences.
Tackle more complex things later.
2018-03-29 02:52 AM
AvaTar wrote:
GPS modules don't take AT commands
As
Turvey.Clive.002
suggested, this probably means that the OP has some kind of (cellular?) modem which integrates a GPS.It would have been helpful if the OP had confirmed that - and even stated what unit is being used!
Googling the
'AT+QGPSCFG' mentioned in the OP suggests that it may be a Quectel UC20 ...
2018-03-29 02:55 AM
sachin singh wrote:
It will be great if can suggest me any good
available
book for the programming.Again, these have already been given in your cross-post on the Keil forum.
And i want to use normal HAL Driver functions of Keil.
The HAL is an ST thing - it has nothing to do with Keil.
2018-03-29 03:13 AM
I have read this, however, the OP was not really clear about his hardware.
Googling the
'AT+QGPSCFG' mentioned in the OP suggests that it may be a Quectel UC20 ...
Sound like a suboptimal hardware choice in light of this:
I am newbie to this STM32L4 Controller. ... As i have mention that i am newbie, I dont know how do I move forward.
I want to Learn the programming in Keil and with their HAL Drive and all.
2018-03-29 03:43 AM
Okay