This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Project with several modules USB, I2C, UART

My project (using STR912) has several modules (USB, I2C, UART), all of them using interrupts for the communication, it happens that all of them work properly separated but once I initialize all of them nothing seems to work anymore ...

I would like to ask you guys if this is the correct order of initializing all the modules, respective clocks and interrupts:

GPIO_Config ();  // GPIO configuration


  // clock configuration
  SCU_MCLKSourceConfig(SCU_MCLK_OSC);
  // Default configuration, wait state insertion :This function should be executed from SRAM when
  //booting from bank1 to avoid  Read-While-Write from the Same Bank.
  FMI_Config(FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE,\ 
    FMI_LVD_ENABLE, FMI_FREQ_HIGH);// Insert 2 Wait States for read
  SCU_PLLFactorsConfig(192, 25, 2); // PLL factors Configuration based on
  // a OSC/Crystal value = 25Mhz
  SCU_PLLCmd(ENABLE);  // PLL Enable and wait for Locking
  SCU_RCLKDivisorConfig(SCU_RCLK_Div1); // RCLK @96Mhz
  SCU_HCLKDivisorConfig(SCU_HCLK_Div1); // AHB @96Mhz
  SCU_FMICLKDivisorConfig(SCU_FMICLK_Div1);// FMI @96Mhz
  SCU_PCLKDivisorConfig(SCU_PCLK_Div2);  //APB @48Mhz
  SCU_MCLKSourceConfig(SCU_MCLK_PLL);   //MCLK @96Mhz
  // working configuration @ 96 Mhz


    // Enable USB clock //
  SCU_AHBPeriphClockConfig(__USB, ENABLE);
  //SCU_AHBPeriphReset(__USB, DISABLE);
  // Enable the UART0 Clock
  SCU_APBPeriphClockConfig(__UART0, ENABLE);
  //SCU_APBPeriphReset(__UART0,DISABLE);
  // Enable the I2C Clock
  SCU_APBPeriphClockConfig(__I2C0,ENABLE);
  // Enable VIC clock
  SCU_AHBPeriphClockConfig(__VIC,ENABLE);
  // SCU_AHBPeriphReset(__VIC,DISABLE);

  VIC_DeInit();

  VIC_Config(USBLP_ITLine, VIC_IRQ, 1);
  VIC_ITCmd(USBLP_ITLine, ENABLE);
  VIC_Config(I2C0_ITLine,VIC_IRQ , 2);
  VIC_ITCmd(I2C0_ITLine, ENABLE);
  VIC_Config(UART0_ITLine, VIC_IRQ, 3);
  VIC_ITCmd(UART0_ITLine, ENABLE);

  USB_Init();
  I2CInit();
  ....

0