cancel
Showing results for 
Search instead for 
Did you mean: 

Net thread is not worked properly when the graphic thread is running (STM32F769)

youssef.amimi
Associate III

I running an application on STM32F769 with EWARM that connect to Servers from the net and receiving data (with Net Thread) . Next i added all necessery files and a graphic Thread in main file to display the data on th lcd when i pressed on a button . When i run the application the lcd works and the button appear but the Net Thread blocked on the instruction ( MX_LWIP_Init();)

PS: when i comment the instruction GRAPHICS_Init(); the board connect to the Net

1 ACCEPTED SOLUTION

Accepted Solutions
youssef.amimi
Associate III

Hi @Martin KJELDSEN​ 

The problem is that I choose TIM1 as a timebase source, this timer is used in STM32F7Instrumentation::init. I change the timebase from TIM1 to TIM6 and it work.

Thank you @Martin KJELDSEN​ for your assistant.

View solution in original post

9 REPLIES 9
Martin KJELDSEN
Chief III

Hi @youssef.amimi​,

I'll try to think about what's wrong here. I'm not that familar with lwip + TouchGFX, but we have a few projects here that we did a while back. The LWIP stack in CubeFW does have it's own issues, so iI'll have to get back to you, is that allright?

Best regards,

Martin

Hi @Martin KJELDSEN​ ,

Ok, thanks for your interest, I will wait for your reply and i will report any progress i have.

Best regards,

Youssef

Great, thanks. I'll try to give it a look tomorrow when i'm at the office,

/Martin

Hi Youssef,

How did you create your ethernet interface configuration? Did you copy it or get it through CubeMX? For the project we have here we the following remarks:

  • CubeMX generated a more correct ethernet interface configuration for us
  • the LWIP documentation is actually very helpful
  • Disabling caching (F7) fixed DMA transfer issues

Besides removing the call to Graphics_init(); did you do any additional debugging? GRAPHICS_init() sets up TouchGFX with the correct HAL and DMA classes, sets the pointer to the start of the framebuffer, etc (Only initialization).

void touchgfx_init()
{
    uint16_t dispWidth = 480;
    uint16_t dispHeight = 272;
 
    HAL& hal = touchgfx_generic_init<STM32F7HAL>(dma, display, tc, dispWidth, dispHeight, (uint16_t*) 0,
                                                 0, 0);
 
    hal.setFrameBufferStartAddress((uint16_t*)frameBuf0, bitdepth, true, true);
 
    hal.setTouchSampleRate(2);
    hal.setFingerSize(1);
 
    // By default frame rate compensation is off.
    // Enable frame rate compensation to smooth out animations in case there is periodic slow frame rates.
    hal.setFrameRateCompensation(false);
 
    // This platform can handle simultaneous DMA and TFT accesses to SDRAM, so disable lock to increase performance.
    hal.lockDMAToFrontPorch(false);
 
    mcuInstr.init();
 
    //Set MCU instrumentation and Load calculation
    hal.setMCUInstrumentation(&mcuInstr);
    hal.enableMCULoadCalculation(true);
}

 One thing you can try to verify the DMA issue is the following - Use NoDMA instead of STM32F7DMA which is the default for F7 based projects.

NoDMA dma;
STM32F746GTouchController tc;
STM32F7Instrumentation mcuInstr;
LCD16bpp display;
 
uint32_t cache[(250*250*3+1000)/4];
    
void touchgfx_init()
{
    HAL& hal = touchgfx_generic_init<STM32F7HAL>(dma, display, tc, 480, 272, (uint16_t*)cache, sizeof(cache), 1);
    os_inited = true;
...

Does that make sense? Let me know.

/Martin

Hi @Martin KJELDSEN​ 

I create my ethernet interface configuration through CubeMX and it worked alone.

I tried to do additionnal debugging and i found that the Net Thread enter in the fonction HAL_Delay(PHY_RESET_DELAY);(in fonction HAL_ETH_Init on file stm32f7xx_hal_eth.c) and never go out.

I use NoDMA instead of STM32F7DMA but steel don't work

PS: When i run with the net configuration alone :

in the HAL_DELAY the variable uwTick = 3(from fonction HAL_GetTick()) incriment until uwTick-tickstart > wait (wait = 256 and tickstart = 3) but when i add graphic the variable uwTick = 1271 is not incrimented (tickstart = 1271 and wait = 256), that's why it never go out.

I didn't find out why uwtick is not incrimented.

youssef.amimi
Associate III

Hi @Martin KJELDSEN​ 

The problem is that I choose TIM1 as a timebase source, this timer is used in STM32F7Instrumentation::init. I change the timebase from TIM1 to TIM6 and it work.

Thank you @Martin KJELDSEN​ for your assistant.

Ah, that's good news. Good job finding that.

/Martin

Thank you @Martin KJELDSEN​ 

Youssef