Esempio n. 1
0
int main(void)
{
	extern void *g_pfnVectors;
    
	SCB->VTOR = (uint32_t)&g_pfnVectors;
	HAL_Init();
	BSP_QSPI_Init();
	FLASHPlugin_InitDone();
    
#ifdef DEBUG
    TestFLASHProgramming(0x90000000, 0);
#endif

	for (;;)
		;
}
Esempio n. 2
0
/**
  * @brief  Initializes LEDs, SDRAM, touch screen, CRC and SRAM.
  * @param  None 
  * @retval None
  */
void k_BspInit(void)
{
  /* Initialize the NOR */
  BSP_QSPI_Init();
  BSP_QSPI_MemoryMappedMode();
  
  /* Initialize the SDRAM */
  BSP_SDRAM_Init();
  
  /* Initialize the Touch screen */
  BSP_TS_Init(420, 272);

  /* Enable CRC to Unlock GUI */
 __HAL_RCC_CRC_CLK_ENABLE();
  
 /* Enable Back up SRAM */
__HAL_RCC_BKPSRAM_CLK_ENABLE();
  
}
Esempio n. 3
0
File: qspi.c Progetto: z80/stm32f429
/**
* @brief  QSPI Demo
* @param  None
* @retval None
*/
void QSPI_demo (void)
{ 
  uint8_t status;
  
  QSPI_SetHint();
  
  /*##-1- Configure the QSPI device ##########################################*/
  /* QSPI device configuration */ 
  status = BSP_QSPI_Init();
  
  if (status == QSPI_NOT_SUPPORTED)
  {
    BSP_LCD_DisplayStringAt(20, 100, (uint8_t*)"QSPI Initialization : FAILED.", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 115, (uint8_t*)"QSPI Test Aborted.", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 145, (uint8_t*)"Check the hardware configuration :", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 160, (uint8_t*)"  refer to the UM of the board", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 175, (uint8_t*)"  for the hardware modifications", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 190, (uint8_t*)"  to connect the QSPI memory", LEFT_MODE);
  }
  else if (status == QSPI_ERROR)
  {
    BSP_LCD_DisplayStringAt(20, 100, (uint8_t*)"QSPI Initialization : FAILED.", LEFT_MODE);
    BSP_LCD_DisplayStringAt(20, 115, (uint8_t*)"QSPI Test Aborted.", LEFT_MODE);
  }
  else
  {
    BSP_LCD_DisplayStringAt(20, 100, (uint8_t*)"QSPI Initialization : OK.", LEFT_MODE);
    
    /*##-2- Read & check the QSPI info #######################################*/
    /* Clear the structure */
    QspiInfo.FlashSize = (uint32_t)0x00;
    QspiInfo.EraseSectorSize = (uint32_t)0x00;
    QspiInfo.EraseSectorsNumber = (uint32_t)0x00;
    QspiInfo.ProgPageSize = (uint32_t)0x00;
    QspiInfo.ProgPagesNumber = (uint32_t)0x00;
    QspiInfo.ManufID = (uint8_t)0x00;
    
    /* Read the QSPI memory info by filling QSPIInfo struct  */
    BSP_QSPI_GetInfo(&QspiInfo);
    
    /* Test the correctness */
    if (CompareInfo() !=QSPI_OK)
    {
        BSP_LCD_DisplayStringAt(20, 115, (uint8_t*)"QSPI GET INFO : FAILED.", LEFT_MODE);
        BSP_LCD_DisplayStringAt(20, 130, (uint8_t*)"QSPI Test Aborted.", LEFT_MODE);
    }
    else
    {
      if (QspiInfo.ManufID == QSPI_S25FL512S)
      {
        BSP_LCD_DisplayStringAt(20, 115, (uint8_t*)"QSPI GET INFO : OK. S25FL512S detected  ", LEFT_MODE);
      } else
      {
        BSP_LCD_DisplayStringAt(20, 115, (uint8_t*)"QSPI GET INFO : OK. N25Q512A detected  ", LEFT_MODE);
      }
      
      /*##-3- Erase QSPI memory ################################################*/ 
      if(BSP_QSPI_Erase_Block(WRITE_READ_ADDR) != QSPI_OK)
      {
        BSP_LCD_DisplayStringAt(20, 130, (uint8_t*)"QSPI ERASE : FAILED.", LEFT_MODE);
        BSP_LCD_DisplayStringAt(20, 145, (uint8_t*)"QSPI Test Aborted.", LEFT_MODE);
      }
      else
      {
        BSP_LCD_DisplayStringAt(20, 130, (uint8_t*)"QSPI ERASE : OK.   ", LEFT_MODE);
        
        /*##-4- QSPI memory read/write access  #################################*/   
        /* Fill the buffer to write */
        Fill_Buffer(qspi_aTxBuffer, BUFFER_SIZE, 0xD20F);   
        
        /* Write data to the QSPI memory */
        if(BSP_QSPI_Write(qspi_aTxBuffer, WRITE_READ_ADDR, BUFFER_SIZE) != QSPI_OK)
        {
          BSP_LCD_DisplayStringAt(20, 145, (uint8_t*)"QSPI WRITE : FAILED.", LEFT_MODE);
          BSP_LCD_DisplayStringAt(20, 160, (uint8_t*)"QSPI Test Aborted.", LEFT_MODE);
        }
        else
        {
          BSP_LCD_DisplayStringAt(20, 145, (uint8_t*)"QSPI WRITE : OK.     ", LEFT_MODE);
          
          /* Read back data from the QSPI memory */
          if(BSP_QSPI_Read(qspi_aRxBuffer, WRITE_READ_ADDR, BUFFER_SIZE) != QSPI_OK)
          {
            BSP_LCD_DisplayStringAt(20, 160, (uint8_t*)"QSPI READ : FAILED.", LEFT_MODE);
            BSP_LCD_DisplayStringAt(20, 175, (uint8_t*)"QSPI Test Aborted.", LEFT_MODE);
          }
          else
          {
            BSP_LCD_DisplayStringAt(20, 160, (uint8_t*)"QSPI READ :  OK.    ", LEFT_MODE);
            
            /*##-5- Checking data integrity ############################################*/  
            if(Buffercmp(qspi_aRxBuffer, qspi_aTxBuffer, BUFFER_SIZE) > 0)
            {
              BSP_LCD_DisplayStringAt(20, 175, (uint8_t*)"QSPI COMPARE : FAILED.", LEFT_MODE);
              BSP_LCD_DisplayStringAt(20, 190, (uint8_t*)"QSPI Test Aborted.", LEFT_MODE);
            }
            else
            {    
              BSP_LCD_DisplayStringAt(20, 175, (uint8_t*)"QSPI Test : OK.     ", LEFT_MODE);
            }  
          }
        }
      }
    }
  }
  
  while (1)
  {    
    if(CheckForUserInput() > 0)
    {
      return;
    }
  }
}
Esempio n. 4
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  uint8_t  lcd_status = LCD_OK;

  /* STM32F4xx HAL library initialization:
    - Configure the Flash prefetch, instruction and Data caches
    - Systick timer is configured by default as source of time base, but user
      can eventually implement his proper time base source (a general purpose
      timer for example or other time source), keeping in mind that Time base
      duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
      handled in milliseconds basis.
    - Set NVIC Group Priority to 4
    - Low Level Initialization: global MSP (MCU Support Package) initialization
  */
  HAL_Init();

  /* Configure the system clock to 180 MHz */
  SystemClock_Config();

  BSP_IO_Init();

  /* Initialise QSPI */
  BSP_QSPI_Init();
  BSP_QSPI_MemoryMappedMode();

  /* Initialize the SDRAM */
  BSP_SDRAM_Init();

  /* Initialize the LCD */
  lcd_status = LCD_Init();
  OnError_Handler(lcd_status != LCD_OK);

  /* Initialize LTDC layer 0 iused for Hint */
  LCD_LayertInit(0, LAYER0_ADDRESS);
  BSP_LCD_SelectLayer(0);

  /* Configure the User Button in GPIO Mode */
  BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI);

   /* Initialize the Touch Screen */
  BSP_TS_Init(800, 480);

  /* Set active display window */
  HAL_DSI_LongWrite(&hdsi_eval, 0, DSI_DCS_LONG_PKT_WRITE, 4, OTM8009A_CMD_CASET, pColLeft);
  HAL_DSI_LongWrite(&hdsi_eval, 0, DSI_DCS_LONG_PKT_WRITE, 4, OTM8009A_CMD_PASET, pPage);

  /* Update pitch : the draw is done on the whole physical X Size */
  HAL_LTDC_SetPitch(&hltdc_eval, BSP_LCD_GetXSize(), 0);


  /* Show first image */
  LL_CopyPicture((uint32_t *)image[ImageIndex], (uint32_t *)LAYER0_ADDRESS);

  valid_buffer = 1;
  active_area = LEFT_AREA;

  HAL_DSI_LongWrite(&hdsi_eval, 0, DSI_DCS_LONG_PKT_WRITE, 2, OTM8009A_CMD_WRTESCN, pSyncLeft);

  /* Infinite loop */
  while (1)
  {
    BSP_TS_GetState(&TS_State);
    if(draw_method == HORIZONTAL_SLIDER)
    {
    LCD_DSI_HorizontalSlider();
    }
    else
    {
     LCD_DSI_VerticalSlider();
    }
  }
}
Esempio n. 5
0
/**
* @brief  Main program
* @param  None
* @retval int
*/
int main(void)
{
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
  */
  HAL_Init();
 
  /* Configure the system clock to 180 MHz */
  SystemClock_Config();

  /* Initialize Touch screen and Leds */
  k_BspInit();
  k_MemInit();
   
  /*Initialize memory pools */
  k_MemInit();
  k_LogInit();
  
  /* Initialise QSPI */
  BSP_QSPI_Init();
  BSP_QSPI_EnableMemoryMappedMode(); 
  
  /*Initialize audio Interface */
  k_BspAudioInit();
  
  /* Initializes backup domain */
  k_CalendarBkupInit();  

  /* Create GUI task */
  osThreadDef(GUI_Thread, GUIThread, osPriorityHigh, 0, 20 * configMINIMAL_STACK_SIZE);
  osThreadCreate (osThread(GUI_Thread), NULL); 
  
  /* Add Modules*/
  k_ModuleInit();

  k_ModuleAdd(&image_browser);  
  k_ModuleOpenLink(&image_browser, "jpg"); 
  k_ModuleOpenLink(&image_browser, "JPG");
  k_ModuleOpenLink(&image_browser, "bmp"); 
  k_ModuleOpenLink(&image_browser, "BMP");
  k_ModuleAdd(&audio_player);  
  k_ModuleOpenLink(&audio_player, "wav"); 
  k_ModuleOpenLink(&audio_player, "WAV"); 
  k_ModuleAdd(&camera_capture);    
  k_ModuleAdd(&system_info);
  k_ModuleAdd(&file_browser);  
  k_ModuleAdd(&cpu_bench);  
  k_ModuleAdd(&game_board);  
  k_ModuleAdd(&usb_device);    
  
  /* Initialize GUI */
  GUI_Init();
    
  /* Enable memory devices */
  WM_SetCreateFlags(WM_CF_MEMDEV);  
   
  GUI_SetBkColor(GUI_WHITE);
  GUI_Clear();   
  
  /* Set General Graphical proprieties */
  k_SetGuiProfile();  

  /* Create Touch screen Timer */
  osTimerDef(TS_Timer, TimerCallback);
  lcd_timer =  osTimerCreate(osTimer(TS_Timer), osTimerPeriodic, (void *)0);

  /* Start the TS Timer */
  osTimerStart(lcd_timer, 40);
 
  /* Start scheduler */
  osKernelStart();

  /* We should never get here as control is now taken by the scheduler */
  for( ;; ); 
}