cancel
Showing results for 
Search instead for 
Did you mean: 

SSD1289 STM32CubeF4

irgendwie6
Associate II
Posted on July 29, 2014 at 18:16

I am a beginner with Stm32f4discovery (version stm32f407vg). It took me a long to get the graphic LCD work (copying and rewriting some code from others).

My problem, I want to use it with FreeRTOS. But My FreeRTOS works in Stm32Cube. And my GLCD works in stm32f4firmware. I tried a lot but I can not get FreeRTOS in Stm32f4 firmware in IAR/arm, nor can I get GLCD work with Stm32cube in Keil.

My question. Who can help to rewrite the following code in stm32cubef4? Please help me. Alternatively, who can send me a working project with freertos, stm32f4 firmware in iar/arm. 

Here is the code:

static void LCD_CtrlLinesConfig(void)

{

GPIO_InitTypeDef GPIO_InitStructure; 

/* Enable GPIOs clock */

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE , ENABLE);

/* Enable FSMC clock */

RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); 

/*-- GPIOs Configuration ------------------------------------------------------*/

/*

+-------------------+--------------------+------------------+------------------+

+                       SRAM pins assignment                                   +

+-------------------+--------------------+

*/

/* GPIOD configuration */

/* Set PD.00(D2), PD.01(D3), PD.04(NOE), PD.05(NWE), PD.08(D13), PD.09(D14),

PD.10(D15), PD.11(A16), PD.14(D0), PD.15(D1) as alternate function push pull */

GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource11, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | 

                           GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 |

GPIO_Pin_14 | GPIO_Pin_15;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_UP;

GPIO_Init(GPIOD, &GPIO_InitStructure);

/* Set PE.07(D4), PE.08(D5), PE.09(D6), PE.10(D7), PE.11(D8), PE.12(D9), PE.13(D10),

PE.14(D11), PE.15(D12) as alternate function push pull */

/* GPIOE configuration */

GPIO_PinAFConfig(GPIOE, GPIO_PinSource2 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource7 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource8 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource9 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource10 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource11 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource12 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource13 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource14 , GPIO_AF_FSMC);

GPIO_PinAFConfig(GPIOE, GPIO_PinSource15 , GPIO_AF_FSMC);

GPIO_InitStructure.GPIO_Pin =GPIO_Pin_2 | GPIO_Pin_7 | GPIO_Pin_8  | GPIO_Pin_9  | GPIO_Pin_10 |

                            GPIO_Pin_11| GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;

GPIO_Init(GPIOE, &GPIO_InitStructure);

        

        /*The following code is not necessary since PD7 is FSMC_NE1 */

        /*

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_UP;

GPIO_Init(GPIOD, &GPIO_InitStructure);

GPIO_ResetBits(GPIOD,GPIO_Pin_7);

        */

}

/*******************************************************************************

* Function Name  : LCD_FSMCConfig

* Description    : Configures the Parallel interface (FSMC) for LCD(Parallel mode)

* Input          : None

* Output         : None

* Return         : None

* Attention : None

*******************************************************************************/

static void LCD_FSMCConfig(void)

{

FSMC_NORSRAMInitTypeDef  FSMC_NORSRAMInitStructure;

FSMC_NORSRAMTimingInitTypeDef FSMC_NORSRAMTimingInitStructure;

FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM4;

FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;

FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;

FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;

FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;

FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;

FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;

FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;

FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;

FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;

FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;

FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;

FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;

FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;

// FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); 

/* FSMCд�ٶ����� */

FSMC_NORSRAMTimingInitStructure.FSMC_AddressSetupTime = 15;//1;   /* ��ַ����ʱ��  */

FSMC_NORSRAMTimingInitStructure.FSMC_AddressHoldTime = 0;   

FSMC_NORSRAMTimingInitStructure.FSMC_DataSetupTime = 15;//1;   /* ���ݽ���ʱ��  */

FSMC_NORSRAMTimingInitStructure.FSMC_BusTurnAroundDuration = 0x00;

FSMC_NORSRAMTimingInitStructure.FSMC_CLKDivision = 0x00;

FSMC_NORSRAMTimingInitStructure.FSMC_DataLatency = 0x00;

FSMC_NORSRAMTimingInitStructure.FSMC_AccessMode = FSMC_AccessMode_A; /* FSMC ����ģʽ */

FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &FSMC_NORSRAMTimingInitStructure;  

FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); 

/* Enable FSMC Bank4_SRAM Bank */

FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM4, ENABLE);  

}

#stm32f4discovery #cube
4 REPLIES 4
Posted on July 29, 2014 at 18:42

My question. Who can help to rewrite the following code in stm32cubef4? Please help me. Alternatively, who can send me a working project with freertos, stm32f4 firmware in iar/arm.

I have about zero interest in free cube support, but did port FreeRTOS 7.1.1 to the F2/F4 and the F4-DISCO in

Keil using the standard firmware. You might want to look over the F4 Ethernet IAP example, it includes FreeRTOS 7.3.0

[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32F4DISCOVERY/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32F4DISCOVERY/Demo%20FreeRTOS%20on%20STM32F4%20Discovery&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580002E3D0FFCC5A9AA4A9C29C3EECB7CCDBF&currentviews=8366]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32F4DISCOVERY/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32F4DISCOVERY%2FDemo%20FreeRTOS%20on%20STM32F4%20Discovery&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580002E3D0FFCC5A9AA4A9C29C3EECB7CCDBF¤tviews=8366

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/FreeRTOS%20to%20STM32F4DISCOVERY%20-%20Crossstudio&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=460

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
irgendwie6
Associate II
Posted on July 29, 2014 at 18:51

Sorry for raising this type of request. But thanks a lot for the hint. I will sure study the examples as you pointed out.

irgendwie6
Associate II
Posted on July 29, 2014 at 20:20

I used the Ethernet Example, delected everything but just left the freertos to switch an led. 

It worked. 

But I do have an issure here. 

Problem: xSemaphoreHandle,no where can i find out where it is defined in the project folder.

Posted on July 29, 2014 at 21:22

STM32F4x7_ETH_LwIP_V1.1.0\Utilities\Third_Party\FreeRTOSV7.3.0\include\semphr.h

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..