cancel
Showing results for 
Search instead for 
Did you mean: 

Control Pins and communicate via usart issue

FLine.1
Associate II

Helleo,

I am newbie in Touchgfx and I try developing first project.

I am willing to data transfer stm32746 to pc via usart and control pins.

When I click the button stm doesnt send data via usart or stm doesnt control pins.

Screen1View.cpp codes:

#include <gui/screen1_screen/Screen1View.hpp>
#include "stm32f7xx_hal.h"
extern UART_HandleTypeDef huart2;
 
Screen1View::Screen1View()
{
 
}
 
void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
}
 
void Screen1View::tearDownScreen()
{
    Screen1ViewBase::tearDownScreen();
}
 
void Screen1View::led_on()
{
 
/*	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_SET);
	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_2|GPIO_PIN_5
	                          |GPIO_PIN_3, GPIO_PIN_SET);
*/
	//HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_5);
	//HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_6);
   // textArea1.setVisible(true);
	char com_cevap[12] ="adc_veri\r\n ";
	HAL_UART_Transmit(&huart2, (uint8_t *) &com_cevap, 12, 200);
    btndurum.setAlpha(254);
    btndurum.invalidate();
 
}
 
void Screen1View::led_off()
{
/*	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_2|GPIO_PIN_5
	                          |GPIO_PIN_3, GPIO_PIN_RESET);
*/
	//HAL_GPIO_WritePin(GPIOD, GPIO_PIN_5, GPIO_PIN_RESET);
	//HAL_GPIO_WritePin(GPIOD, GPIO_PIN_6, GPIO_PIN_RESET);
    btndurum.setAlpha(50);
    btndurum.invalidate();
 
}

0693W000006GtqXQAS.png 

please tell me whats wrong? Could i control pins or data transfer in button click?

I use STMCubeIDe 1.5.1, Visual Studio 2019 and last framework.TouchGfx 4.15

22 REPLIES 22
MM..1
Chief III

DISCO-F746NG | Mbed read image with pinout description

FLine.1
Associate II

Finally

0693W000006HYpGQAW.png

Yes this is because

HAL_UART_Transmit(&huart2, (uint8_t *)giden,10,30);

when you not need send binary zero then change line to

HAL_UART_Transmit(&huart2, (uint8_t *)giden,strlen(giden),30);