2019-03-11 12:39 AM
Dear Members,
I want to read a result from my GPS,
it's Neo 6M
I initialized 2 UARTs UART 1 for PC and UART 2 for GPS,
I got this result :
INIT CODE GPS NEO - 6M....
From GPS :
Is it receiving properly ?
The code :
char in[8];
printf("From GPS : ");
HAL_UART_Receive(&huart2, (uint8_t *)in, 8, 1000);
HAL_UART_Transmit(&huart1, (uint8_t *)in, 8, 1);
printf("\r\n");
Green LED on GPS module is blinking...
Thanks
2019-03-14 11:30 PM
I have some confuse regarding such type of function
"void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart"
like this also
"HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)"
they are only use before main or any where in main because i am using ADC my program goes in function where is ADC value is used but its' not show me ADC value on my screen so i want to 0 use "HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)" function. it will help or not
2019-03-15 05:30 AM
is void USART_GPS_IRQHandler(void) // Sync and Queue NMEA Sentences
equal to
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) ?
so I will move the content of that function to this function ?
2019-03-15 05:31 AM
I don't understand the code ?? how can I connect it with my STM32L152RE ?
2019-03-15 05:54 AM
2019-03-15 05:56 AM
the code :
/* USER CODE BEGIN 0 */
void startRx()
{
// pretty inefficient but will probably be ok for 9600
uint32_t offset = (rxChars & 0x1f); // so count is actual receive count but offset is buffer index
HAL_UART_Receive_IT(MYUART, rxBuffer+offset, 1);
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef* huart)
{
if (huart==MYUART)
{
rxChars += 1; // char is already in our buffer, inc count and bail out quickly since this is a callback
}
}
/* USER CODE END 0 */
in main :
printf("From GPS : ");
if (lastRxChars != rxChars)
{
printf("now I have %lu chars\n", rxChars);
lastRxChars = rxChars;
startRx();
}
it never gets inside if ....??
2019-03-15 05:59 AM
without
if (lastRxChars != rxChars)
I got :
INIT CODE GPS NEO - 6M....
From GPS : now I have 0 chars
INIT CODE GPS NEO - 6M....
2019-03-15 08:07 AM
It is the USART2_IRQHandler() or whatever the #define says it is.
The HAL Callback methods are far too circuitous and not really compatible with the byte-at-a-time interrupts coming from the USART. NMEA data rarely falls on convenient 10 or 100 byte boundaries.
2019-03-15 08:16 AM
Ok, so we're about 25 questions into the thread before the specific STM32 part is identified.
What board is this on? A standard NUCLEO board, or something else?
It would take some effort on my part to port this to the L1 platform.
2019-03-16 05:25 AM
STM32L152LE
It's Nucleo board without a programmer on it, so I use ST-link for it,
Please find STM32CubeMX file below, is it right ?
Thanks
2019-03-16 05:50 AM
STM32L152 doesn't have ICR register ...??
can I disable it ?