Skip to main content
AD�?b
Senior
April 24, 2020
Question

STM32F746G-DISCO, TouchGFX 4.13.0, STMCubeIDE 1.3.0, FreeRTOS

  • April 24, 2020
  • 20 replies
  • 5118 views

Hi!

How to set FreeRTOS for 2 tasks and queue 2?

How to add support in main.c and Model.cpp?

Andrzej

This topic has been closed for replies.

20 replies

Karan 123
Senior
April 24, 2020

Hi,

Please Check Below Image . Hope this helps..

0693W000000WRNkQAO.png

--

Karan

AD�?b
AD�?bAuthor
Senior
April 25, 2020
Hi! I set. I generated the code. But what's next? Andrzej pt., 24 kwi 2020 o 19:41 ST Community napisał(a):
chaaalyy
Senior II
April 24, 2020

After creation with cubeMX, you´ll find the new "task function" in main.c (scroll far down to find it...). In model.cpp, you can declare the generated queues and semaphores external (as they are already prepared in main.c) and use them, as usual. If you need an example, how to work with freeRtos together with TouchGFX, maybe this could help you:

https://www.youtube.com/watch?v=EbWOv_0Lp-U&t=1855s

Maybe the context (ADC via DMA...) isn´t interesting, but it shows very well the basic principles :)

AD�?b
AD�?bAuthor
Senior
April 30, 2020

Several times my program hung up. Can this cause external interrupts?

I work with FreeRTOS.

Karan 123
Senior
April 30, 2020

No. External Interrupts works well .

These should work ..

Please check attach working file and ISR Routine ..

extern osMessageQId messageQ ;
 
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
	uint8_t msg = 1;
	if(GPIO_Pin == GPIO_PIN_11)
	{
		if(uxQueueMessagesWaitingFromISR( messageQ ) == 0)
		{
			// Non-ISR versions of FreeRTOS methods used to put tasks into states.
			// This is an interrupt handler. Queues are much busier when used from a task.
			// Cannot block on a queue from ISR. Scheduler queues tasks blocked on same queue in prio order.
			//
			// This method clears the interrupt every time, so we're only sending signals
			// to the gui every time we press the button.
 
			HAL_GPIO_TogglePin(LED_GPIO_Port , LED_Pin) ;
			xQueueSendFromISR(messageQ, &msg, 0 );
		}
 
 
	}
	while(HAL_GPIO_ReadPin(GPIOI, GPIO_PIN_11) != GPIO_PIN_RESET);//Blue pushbutton – PI11
}

--

Karan

AD�?b
AD�?bAuthor
Senior
April 30, 2020

Thanks!

AD�?b
AD�?bAuthor
Senior
May 6, 2020

Hi!

I have this error in Screen1View.cpp

expected unqualified-id before '-> ' token

Why?

Karan 123
Senior
May 7, 2020

Hi,

Please change

Presenter->askForNextNumber();

to

presenter->askForNextNumber();

then yet . It should work.

--

Karan

AD�?b
AD�?bAuthor
Senior
May 7, 2020

Hello

Thank you. OK.

Andrzej

AD�?b
AD�?bAuthor
Senior
May 8, 2020

Hi!

How to send the number set on the screen to UI?

How to send to View from Model?

Andrzej

Karan 123
Senior
May 8, 2020

You mean array.

AD�?b
AD�?bAuthor
Senior
May 9, 2020

Hi!

STM32F746G-DISCO. I attach the program. With Model to UI it works correctly. I don't know how to send "unsigned int time" from View to Presenter and from Presenter to Model?

Andrzej

Karan 123
Senior
May 9, 2020

As far as concern of your code, I think you have missed like below

// From Model
void Screen1Presenter::btnPressed()
{
	view.IncrementUpdate() ;
	 touchgfx_printf("View \n");
}
// From View
void Screen1Presenter::setLEDState(bool state)
{
	model->setLEDState(state);
	 touchgfx_printf("LED State:1 %d\n", state);
}

Hope this helps..

--

Karan