Esempio n. 1
0
int platform_init()
{
  // Set up microcontroller system and SystemCoreClock variable
  SystemInit();

  // DeInit NVIC and SCBNVIC
  NVIC_DeInit();
  NVIC_SCBDeInit();

  // Configure the NVIC Preemption Priority Bits:
  // two (2) bits of preemption priority, six (6) bits of sub-priority.
  // Since the Number of Bits used for Priority Levels is five (5), so the
  // actual bit number of sub-priority is three (3)
  NVIC_SetPriorityGrouping(0x05);

  //  Set Vector table offset value
#if (__RAM_MODE__==1)
  NVIC_SetVTOR(0x10000000);
#else
  NVIC_SetVTOR(0x00000000);
#endif

  // Setup peripherals
  platform_setup_timers();
  //platform_setup_pwm();

#ifdef BUILD_ADC
  // Setup ADCs
  platform_setup_adcs();
#endif

  // Setup CANs
  cans_init();

  // Setup pin routing
  platform_setup_pins();

  // System timer setup
  cmn_systimer_set_base_freq( lpc17xx_get_cpu_frequency() );
  cmn_systimer_set_interrupt_freq( SYSTICKHZ );

  // Enable SysTick
  SysTick_Config( lpc17xx_get_cpu_frequency() / SYSTICKHZ );

  // Common platform initialization code
  cmn_platform_init();

  return PLATFORM_OK;
}
Esempio n. 2
0
int platform_init()
{
  // Complete CPU initialization
  platform_setup_cpu();

  // External memory
  platform_setup_extmem();   

  // Setup peripherals
  platform_setup_timers();
  platform_setup_pwm();
  
#ifdef BUILD_ADC
  // Setup ADCs
  platform_setup_adcs();
#endif

  // Common platform initialization code
  cmn_platform_init();

  return PLATFORM_OK;
}