2019-03-08 03:53 AM
I want to send data using UART, I've configured everything but I don't get any data output unfortunately.
My question is whether this can be because of the fact that I am doing nothing with xTaskCreate? When should xTaskCreate be used and should I use it in my case?
2019-03-08 05:00 PM
Hi @LTech,
You're not getting any data output from what exactly (What is your application trying to do)? You don't _need_ to use additional OS tasks, even with TouchGFX, to integrate with peripherals, but it's often a good idea depending on the complexity of your application.
Are you sure you've configured the UART correctly? Did you get a basic application working without TouchGFX? Maybe try some of the Cube Firmware examples.
Best regards,
Martin
2019-03-12 03:40 AM
Hello @Martin KJELDSEN ,
I am using TouchGFXDesigner 4.10.0
UPDATE: it is able to send my message via UART if I place
HAL_UART_Transmit_DMA(&MyUART, (uint8_t *) MyMessage, 7);
before the line
GRAPHICS_HW_Init();
inside main.cpp but then it won't display anything on the screen.
I want to send the data using HAL_UART_Transmit_DMA whenever I press a button that I've placed on the screen which is defined inside MainView.cpp but I cannot simply include the header file because it still won't find MyUART and MyMessage if I place it there.
2019-03-12 05:27 AM
@Martin KJELDSEN If you can answer the following question, then my problem is solved:
Inside MainView.cpp I want to use HAL_UART_Transmit_DMA but it simply cannot find any of the UART functions. Including header files such as #include "stm32f769i_discovery.h" or #include "stm32f7xx_hal_uart.h" doesn't work (even giving the relative path doesn't work).
Any solution?
2019-03-12 05:36 AM
You should avoid mixing target specific code with GUI code (MainView.cpp) to keep things simple. Do the setup inside the MainViewPresenter by calling a transmit() method on the model instead. (The presenter has a pointer to the Model)
You said you were able to call the function before, so you must have set up the proper include paths, etc.
/Martin
2019-03-13 01:38 AM
I've changed the code as you said,
Inside Model.cpp I have something like:
#ifndef SIMULATOR // optional
#include "stm32f769i_discovery.h"
#endif
void Model::SendMODE()
{
HAL_UART_Transmit_DMA(&MyUART, (uint8_t *) MyMessage, 7);
}
but it seems when I click on Run Target inside Touchgfx designer, the compiler simply cannot find stm32f769i_discovery.h . The Makefile is also correct.
If I remove the line HAL_UART_Transmit_DMA(&MyUART, (uint8_t *) MyMessage, 7); it works but it simply doesn't include "stm32f769i_discovery.h" (for example when I remove the lines #ifndef SIMULATOR #endif and HAL_UART_Transmit_DMA(&MyUART, (uint8_t *) MyMessage, 7); it gives the error that it cannot find/include "stm32f769i_discovery.h".
Any possible solution?
2019-03-13 01:39 AM
With me saying "it works" I meant to say it doesn't give any errors.
2019-03-13 04:40 AM
Do I have to make use of xQueueHandle and xTaskCreate to achieve what I want?
2019-03-14 01:44 AM
Yes. You can get some inspiration from the examples in this article for how to send data between two tasks.
https://touchgfx.zendesk.com/hc/en-us/articles/205074561-Connecting-the-UI-to-your-system
2019-03-14 01:53 AM
Funny you mentioned that, as I have modified one of those examples yesterday :)
UART initialization works (verified it), but in hw_integration_tasks_gpio example, I use
switch(msg)
{
case LED_ON:
BSP_LED_On(LED_GREEN);
HAL_UART_Transmit_DMA(&UART_ESP_CMTypeDef, (uint8_t *) MyMessage, SizeOfMessage);
break;
....
}
if I flash it onto the target, and press the red toggle button the LED goes on and it transmits three numbers '208', '146', '252' and then it is stuck (I changed the GUI stacks size).