External Bus Driver

The External Bus Interface (EBI) connects external memory and peripheral devices such as static memory and SDRAM, so that they can be accessed via reading or writing to their address spaces.

Summary of the API's Functional Features

No special API is provided for this driver, just accessing the external memory via their address space.

The configured EBI parameters in Atmel START are automatically initialized via atmel_start_init() in main.c.

Summary of Configuration Options

Depend on device, all EBI parameters can be configured in START, such as pin signals, chip select, and bus timing etc.

Example of Usage

The following shows a simple example of access external memory. The EBI parameters must be configured correctly according to hardware in START. The EBI driver must have been initialized by atmel_start_init(). This initialization will configure the operation of the hardware EBI instance.

          /** Memory base address for EBI access example */
          #warning no external memory enabled, please check!
          static uint32_t MEM_BASE[1];
          /*
           * Example of accessing external bus memory
           */
          void EXTERNAL_BUS_0_example(void)
          {
              volatile uint32_t *pu32 = (uint32_t *)MEM_BASE;
              volatile uint16_t *pu16 = (uint16_t *)MEM_BASE;
              volatile uint8_t * pu8  = (uint8_t *)MEM_BASE;
              /* Backup one WORD */
              uint32_t bak = _ext_bus_read_u32((void *)pu32);
              /* Write and verify BYTE */
               *pu8 = 0xAA;
              if (*pu8 != 0xAA) {
                  /* Error ! */
                  while (1)
                      ;
              }
               *pu8 = 0x55;
              if (*pu8 != 0x55) {
                  /* Error ! */
                  while (1)
                      ;
              }
              /* Write and verify HALF WORD */
               *pu16 = 0xAAAA;
              if (*pu16 != 0xAAAA) {
                  /* Error ! */
                  while (1)
                      ;
              }
               *pu16 = 0x5555;
              if (*pu16 != 0x5555) {
                  /* Error ! */
                  while (1)
                      ;
              }
              /* Write and verify WORD */
               *pu32 = 0xAAAA5555;
              if (*pu32 != 0xAAAA5555) {
                  /* Error ! */
                  while (1)
                      ;
              }
               *pu32 = 0x5A5A55AA;
              if (*pu32 != 0x5A5A55AA) {
                  /* Error ! */
                  while (1)
                      ;
              }
              /* Restore one WORD */
              _ext_bus_write_u32((void *)pu32, bak);
          }
        

Dependencies

  • External bus interface