2024-08-01 09:00 AM - edited 2024-08-01 11:28 PM
Hello dear community,
I'm interested in the en.x-cube-gnss1 middleware package as I'm developping a solution based on a custom GPS module.
For me, this ST package is a good starting point to write my own package. More over, I would want to use it with Azure RTOS.
So,
In a first attempt, I configured a sort of "generic" project around the STM32U5A9J-DK / en.x-cube-gnss1 and generate the code to see how it works. In my case, the GPS module is wired to STM32 thought LPUART1
As I understood, when starting the app creates 3 threads:
190: ret = tx_thread_create(&teseoConsumerTaskHandle, "TeseoConsumerTask", TeseoConsumerTask, 0,
211: ret = tx_thread_create(&backgroundTaskHandle, "BackgroundTask", BackgroundTask, 0,
231: ret = tx_thread_create(&consoleParseTaskHandle, "ConsoleParseTask", ConsoleParseTask, 0,
In a trial purpose, I just added one extra menu in the CLI (located in /GNSS/App/app_gnss.c)
static void AppCmdProcess(char *com)
to have the hability to send one command manually to the GPS. So on the terminal it looks like:
Extra menu option is "20", which permits to type manually the command to be sent to the GPS through LPUART1
Basically, it just uses this function:
GNSS_DATA_SendCommand((uint8_t *)com);
where the *com is the entered string that comes from the CLI. Then, datas are placed by Azure in a queue to be
finally sent by BSP_LPUART1_Send_IT :
int32_t BSP_LPUART1_Send_IT(uint16_t DevAddr, uint8_t *pData, uint16_t Length)
{
int32_t ret = BSP_ERROR_BUS_FAILURE;
UNUSED(DevAddr);
if(HAL_UART_Transmit_IT(&hlpuart1, (uint8_t *)pData, Length) == HAL_OK)
{
ret = BSP_ERROR_NONE;
}
else
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
return ret;
}
But unfortunately, nothing happens physically, PG7 output (LPUART1_TX) stays always high.
However,
if I send datas with "BSP_LPUART1_Send" function soon after choosing the right option in the menu, instead of using the intented function "GNSS_DATA_SendCommand" it works as I would espect. But this isn't very clean in the whole Azure system.
Can you help me please ?
Thanks a lot in advance.
2024-08-20 02:08 AM
Hello everybody,
I suceeded to output something on LPUART1 : I just forgot to enable LPUART1 global interrupt !
2024-08-20 02:29 AM
But now,
I've got another problem...
With my "sendcommand" menu, I can now send any command to the GPS module.
For example, if I send the "$PSTMGETSWVER" command, I see something happening on LPUART_TX, and in reply the GPS send something on LPUART_RX. So sending commands works well.
But despite receiving something on LPUART1_RX coming from the GPS module,
The TeseoConsumerTask is always in SLEEP(1) state,
whereas ConsoleParseTask always in running state.
After executing step-by-step,
I found that it comes into
const TESEO_LIV3F_Msg_t *teseo_queue_claim_rd_buffer(TESEO_LIV3F_Queue_t *pTeseoQueue)
(in /project/Drivers/BSP/Components/teseo_liv3f/teseo_liv3f_queue.c)
but never get any available buffer as pTeseoQueue->bitmap_buffer_readable is always 0:
/* first available readable buffer */
i = teseo_ffs(pTeseoQueue->bitmap_buffer_readable);
if (i == 0) {
#if (ANY_RTOS)
/* release the semaphore */
semaphore_free(pTeseoQueue->semaphore);
//PRINT_DBG("No read buffer available... going to sleep...\n\r");
os_delay();
continue;
Any clue ?
Thanks a lot in advance for your valuable help.
2024-08-20 06:03 AM
In
typedef struct
{
#if (USE_FREE_RTOS_NATIVE_API)
SemaphoreHandle_t semaphore;
uint32_t bitmap_unreleased_buffer_irq;
#endif /* USE_FREE_RTOS_NATIVE_API */
#if (USE_AZRTOS_NATIVE_API)
TX_SEMAPHORE semaphore;
uint32_t bitmap_unreleased_buffer_irq;
#endif /* USE_AZRTOS_NATIVE_API */
#if (osCMSIS)
#if (osCMSIS < 0x20000U)
osSemaphoreId semaphore;
uint32_t bitmap_unreleased_buffer_irq;
#elif (osCMSIS >= 0x20000U)
osSemaphoreId_t semaphore;
uint32_t bitmap_unreleased_buffer_irq;
#endif /* (osCMSIS < 0x20000U) */
#endif /* osCMSIS */
uint32_t bitmap_buffer_writable;
uint32_t bitmap_buffer_readable;
SONY_CXD56XX_Msg_t nmea_queue[MAX_MSG_QUEUE];
uint8_t single_message_buffer[MAX_MSG_QUEUE * MAX_MSG_BUF];
} SONY_CXD56XX_Queue_t;
What's purpose of
uint32_t bitmap_buffer_readable;
?