|
struct | EBI_CS_cfg_t |
| Configuration structure for an External Bus Interface (EBI) chip select. More...
|
|
|
void | ConfigureEBI_CSPin (int csNum) |
| Configure the I/O pin for a given Chip Select for the external data bus.
|
|
void | ConfigureEBI_NWRPin () |
| Configure the I/O pin for the active low write/read (NWR) bus signal.
|
|
void | ConfigureEBI_NRDPin () |
| Configure the I/O pin for the active low read (NRD) bus signal.
|
|
void | ConfigureEBI_CS (uint32_t csNum, const EBI_CS_cfg_t &&cfg) |
| Configure the given Chip Select for the external data bus (rvalue reference version).
|
|
void | ConfigureEBI_CS (uint32_t csNum, const EBI_CS_cfg_t &cfg) |
| Configure the given Chip Select for the external data bus (lvalue reference version).
|
|
Supported Platforms: MODM7AE70
The Microchip SAME70 EBI peripheral is a parallel communication port that can only operate in "host" mode to communicate with "slave" devices. The EBI peripheral consists of a set of up to 16 data signals, up to 24 address signals and up to 10 different control signals. Some of the benefits of using the EBI bus are that it has high performance in both throughput and latency. It is directly memory mapped to the processor so it is very easy to use in software once configured. The downsides are mostly that it has many signals which will greatly complicate hardware designs and increase the size of external peripheral chips.
The EBI peripheral is highly configurable to fit the specifications of many types of external devices.
A consequence to this high configurablity is that there are many timing parameters which makes configuration
complicated. The NetBurner examples specify a conservative set of timing parameters with the goal of being compatible with a wide range of peripherals such as FPGAs, CPLDs, buffers, latches displays, flash memory and SRAM. Once successful communication is obtained with the slave target device, these default settings should be refined to increase the performance to match the device you are interfacing with.
Advanced EBI functionality is currently not supported by this examples or this driver. Advaced functionality includes interfacing with SDRAM or NAND memories. Page mode, burst operations and scrambling functionality are all not currently configurable via this driver.
In most applications you will only need to verify the last 5 parameters meet your peripheral requirements: bus width (8 or 16), byte Access 16-bit mode only), timing parameters, read mode (chip select or read signal) and write mode (chip select or write signal).
There are 3 sources of information that are very useful for understanding the EBI:
- The EBI section of the Microchip SAME70 manual located in "\nburn\docs". It is very important to do this as the first step to understand the signal terminology in the examples and header files. Additionally the Static Memory Controller chapter in this processor manual is essential as it explains all the settings and timing parameters exposed by this driver.
- The NetBurner EBI examples described in the manual and located in "\nburn\examples\PlatformSpecific\MODM7AE70"
- The SAME70 ebi.h header file located in "\nburn\arch\cortex-m7\cpu\SAME70\include"
The EBI supports Chip Selects as well as Read and Write signals to interface with peripherals. The basic procedure for configuring the bus is:
- As noted in the examples, the MODM7AE70 has onboard bus buffers to reduce noise and help signal integrity. The following 4 signals must always be configured for EBI functionality as they are control the enable/disable and direction control of the bus buffer ICs:
P1[5].function(PINP1_5_NCS2);
P1[6].function(PINP1_6_NCS0);
P1[7].function(PINP1_7_NCS3);
P1[8].function(PINP1_8_NRD);
- Declare a Configuration Structure of type EBI_CS_cfg_t. An easy way is to copy one from the examples. Then modify any parameters necessary to meet your specific peripheral requirements, such as bus width, byte access in 16-bit mode, timing parameters, etc.
Configure the desired chip select using the ConfigureEBI_CS()function. Note that when enabling the EBI, the MODM7AE70 module requires all three chip selects (NCS0, NCS02, NCS03) to be assigned as chip selects. Addtionally the NRD signal must also be configured for NRD bus operation. All of these signals are used for controlling the enable/direction logic of the external bus buffer hardware - they cannot use their alternate functions. Each chip select has a predefined fixed 16MB address range ( MODM7AE70 Memory Map). The NetBurner API supplied predefined base address variables to make access easier as demonstrated in the EBI examples:
extern volatile uint8_t ebi_0_base[];
extern volatile uint8_t ebi_1_base[];
extern volatile uint8_t ebi_2_base[];
extern volatile uint8_t ebi_3_base[];
In this way you can do a bus write with code such as (please refer to EBI examples for latest code):
const uint8_t EBITestData8 = 0x5A;
const uint32_t EBITestAddressOffset = 0xA5A5;
ebi_0_base[EBITestAddressOffset] = EBITestData8;
ebi_0_base[0xA5A5] = 0X5A;
uint32_t EBIdata = ebi_0_base[EBITestAddressOffset];
- Warning
- When enabling the EBI for the MODM7AE70 module, NCS0, NCS2, NCS3 and NRD must all be configured for their bus functionality as chip selects or nRead signals, even if not used by your application - they cannot be assigned their alternate functions. Additionally the "void EnableExtBusBuff(bool enable);" function from bsp.h must be used to enable the external bus buffer hardware.
◆ EBI_CS_BusWidth_t
#include <ebi.h>
Data bus width configuration for External Bus Interface.
Specifies the data bus width for communication with external devices on the EBI. The bus width must match the physical connection and capabilities of the external device connected to the chip select.
- Note
- The bus width setting affects how data is transferred and accessed on the external bus. Ensure the external device supports the selected width.
- See also
- EBI_CS_ByteAccess_t
Enumerator |
---|
EBI_BUS_WIDTH_8 | 8-bit data bus width (D0-D7)
|
EBI_BUS_WIDTH_16 | 16-bit data bus width (D0-D15)
|
◆ EBI_CS_ByteAccess_t
#include <ebi.h>
Byte access mode for 16-bit bus configurations.
Controls how 8-bit accesses are handled when the bus is configured for 16-bit mode. This setting determines which control signal (chip select or write enable) is used to select the high or low byte during 8-bit transfers on a 16-bit bus.
- Note
- This setting is only relevant when using EBI_BUS_WIDTH_16. It has no effect in 8-bit bus mode.
- Warning
- Incorrect byte access configuration can result in data corruption when performing byte-level operations on a 16-bit bus.
- See also
- EBI_CS_BusWidth_t
Expand for Example Usage
Examples
- Example 1: Configuring byte access using chip select
void ConfigureEBI_16BitWithByteAccess() {
iprintf("16-bit bus configured with CS byte select\r\n");
}
EBI_CS_ByteAccess_t
Byte access mode for 16-bit bus configurations.
Definition ebi.h:430
EBI_CS_BusWidth_t
Data bus width configuration for External Bus Interface.
Definition ebi.h:374
@ EBI_BYTE_ACCESS_SELECT
Use chip select signal to access individual bytes on 16-bit bus.
Definition ebi.h:431
@ EBI_BUS_WIDTH_16
16-bit data bus width (D0-D15)
Definition ebi.h:376
- Example 2: Configuring byte access using write signal
void ConfigureEBI_16BitWithWriteByteAccess() {
iprintf("16-bit bus configured with write signal byte select\r\n");
}
@ EBI_BYTE_ACCESS_WRITE
Use write enable signal to access individual bytes on 16-bit bus.
Definition ebi.h:432
Enumerator |
---|
EBI_BYTE_ACCESS_SELECT | Use chip select signal to access individual bytes on 16-bit bus.
|
EBI_BYTE_ACCESS_WRITE | Use write enable signal to access individual bytes on 16-bit bus.
|
◆ EBI_CS_NWait_t
#include <ebi.h>
NWAIT signal configuration for bus cycle extension.
Controls how the external NWAIT signal is used to extend read/write cycles when interfacing with slow external devices. The NWAIT signal allows external devices to insert wait states, extending the access time as needed.
This is commonly used with:
- Slow flash memory devices
- Variable-speed peripherals
- Devices that need dynamic timing adjustment
- Note
- When disabled, the NWAIT signal is ignored and all timing is determined by the configured setup, pulse, and hold times.
-
In Frozen mode, the NWAIT signal can extend the access time indefinitely while the signal is asserted.
-
In Ready mode, the NWAIT signal is sampled and can control cycle extension based on device readiness.
- Warning
- Using NWAIT modes with devices that don't properly drive the NWAIT signal can result in bus hangs or indefinite waits.
Expand for Example Usage
Examples
- Example 1: Disabled NWAIT for fast SRAM
void ConfigureFastSRAM() {
iprintf("EBI configured for fast SRAM (NWAIT disabled)\r\n");
}
EBI_CS_NWait_t
NWAIT signal configuration for bus cycle extension.
Definition ebi.h:521
@ EBI_NWAIT_DISABLED
NWAIT signal ignored, all timing from configuration registers.
Definition ebi.h:522
- Example 2: Frozen mode for slow flash memory
void ConfigureSlowFlash() {
iprintf("EBI configured for flash with frozen NWAIT mode\r\n");
}
@ EBI_NWAIT_FROZEN
NWAIT can freeze/extend the access cycle indefinitely.
Definition ebi.h:523
- Example 3: Ready mode for variable-speed peripheral
void ConfigureVariableSpeedDevice() {
iprintf("EBI configured with ready mode NWAIT\r\n");
}
@ EBI_NWAIT_READY
NWAIT sampled to determine device ready state.
Definition ebi.h:524
- Example 4: Comparing NWAIT modes for different device types
void ConfigureMultipleDevices() {
iprintf("Configured 3 devices with different NWAIT modes\r\n");
}
Enumerator |
---|
EBI_NWAIT_DISABLED | NWAIT signal ignored, all timing from configuration registers.
|
EBI_NWAIT_FROZEN | NWAIT can freeze/extend the access cycle indefinitely.
|
EBI_NWAIT_READY | NWAIT sampled to determine device ready state.
|
◆ EBI_CS_RdMode_t
#include <ebi.h>
Read control signal selection.
Determines which signal controls read operations from external devices on the EBI. This setting affects how read cycles are generated and controlled.
- NCS mode: Read cycle controlled by chip select assertion
- NRD mode: Read cycle controlled by dedicated read enable signal
- Note
- NRD (Read Enable) mode provides more precise read timing control and is commonly used with memory devices that have separate read enable inputs.
-
NCS mode may be suitable for simpler devices or when minimizing control signal requirements.
- See also
- EBI_CS_WrMode_t
-
ConfigureEBI_NRDPin()
Expand for Example Usage
Examples
- Example 1: Using NRD for standard SRAM
void ConfigureSRAM_WithReadEnable() {
iprintf("SRAM configured with NRD read control\r\n");
}
EBI_CS_RdMode_t
Read control signal selection.
Definition ebi.h:685
void ConfigureEBI_NRDPin()
Configure the I/O pin for the active low read (NRD) bus signal.
@ EBI_READ_MODE_NRD
Read controlled by read enable (NRD) signal.
Definition ebi.h:687
- Example 2: Using NCS for simple peripheral
void ConfigureSimpleReadDevice() {
iprintf("Device configured with NCS read control\r\n");
}
@ EBI_READ_MODE_NCS
Read controlled by chip select (NCS) assertion.
Definition ebi.h:686
- Example 3: Complete read/write configuration
void ConfigureExternalMemory() {
iprintf("Memory configured with NRD/NWE control signals\r\n");
}
EBI_CS_WrMode_t
Write control signal selection.
Definition ebi.h:594
void ConfigureEBI_NWRPin()
Configure the I/O pin for the active low write/read (NWR) bus signal.
@ EBI_WRITE_MODE_NWE
Write controlled by write enable (NWE) signal.
Definition ebi.h:596
- Example 4: Mixed control modes for different chip selects
void ConfigureMixedDevices() {
iprintf("CS0: Full control signals (NRD/NWE)\r\n");
iprintf("CS1: Chip select only (NCS)\r\n");
}
@ EBI_WRITE_MODE_NCS
Write controlled by chip select (NCS) assertion.
Definition ebi.h:595
Enumerator |
---|
EBI_READ_MODE_NCS | Read controlled by chip select (NCS) assertion.
|
EBI_READ_MODE_NRD | Read controlled by read enable (NRD) signal.
|
◆ EBI_CS_WrMode_t
#include <ebi.h>
Write control signal selection.
Determines which signal controls write operations to external devices on the EBI. This setting affects how write cycles are generated and controlled.
- NCS mode: Write cycle controlled by chip select assertion
- NWE mode: Write cycle controlled by dedicated write enable signal
- Note
- NWE (Write Enable) mode provides more precise write timing control and is commonly used with memory devices that have separate write enable inputs.
-
NCS mode may be suitable for simpler devices or when minimizing control signal requirements.
- See also
- EBI_CS_RdMode_t
-
ConfigureEBI_NWRPin()
Expand for Example Usage
Examples
- Example 1: Using NWE for standard SRAM
void ConfigureSRAM_WithWriteEnable() {
iprintf("SRAM configured with NWE write control\r\n");
}
- Example 2: Using NCS for simple peripheral
void ConfigureSimplePeripheral() {
iprintf("Peripheral configured with NCS write control\r\n");
}
- Example 3: Comparing write modes for different devices
void ConfigureMultipleDeviceWrites() {
iprintf("CS0: NWE mode for memory\r\n");
iprintf("CS1: NCS mode for I/O\r\n");
}
Enumerator |
---|
EBI_WRITE_MODE_NCS | Write controlled by chip select (NCS) assertion.
|
EBI_WRITE_MODE_NWE | Write controlled by write enable (NWE) signal.
|
◆ ConfigureEBI_CS() [1/2]
void ConfigureEBI_CS |
( |
uint32_t | csNum, |
|
|
const EBI_CS_cfg_t && | cfg ) |
#include <ebi.h>
Configure the given Chip Select for the external data bus (rvalue reference version).
Configures an External Bus Interface (EBI) chip select with the specified timing and control parameters. This overload accepts an rvalue reference, allowing efficient configuration with temporary configuration objects.
This function sets up all timing parameters (setup, pulse, hold times), control signal modes, bus width, and wait state configuration for the specified chip select line.
- Parameters
-
csNum | The EBI Chip Select number to configure (typically 0-3, platform-dependent). |
cfg | Rvalue reference to the configuration structure. The configuration is moved into the function, making this efficient for temporary configuration objects. |
- Note
- This function should be called after pin configuration functions:
-
All timing parameters in the configuration are specified in EBI clock cycles. Calculate the required values based on your EBI clock frequency and device datasheet.
- Warning
- Incorrect timing configuration can cause data corruption or device malfunction. Always verify timing parameters against the external device datasheet.
-
Ensure the chip select number is valid for your platform. Invalid values may result in undefined behavior.
- See also
- ConfigureEBI_CS(uint32_t, const EBI_CS_cfg_t&)
-
ConfigureEBI_CSPin()
-
EBI_CS_cfg_t
Expand for Example Usage
Examples
- Example 1: Configure CS0 with temporary configuration object
void InitializeExternalSRAM() {
.nrd_setup = 2,
.ncs_rd_pulse = 10,
.nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2,
.nwe_setup = 2,
.ncs_wr_pulse = 10,
.nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
});
iprintf("CS0 configured for SRAM\r\n");
}
uint8_t ncs_rd_setup
Definition ebi.h:1154
void ConfigureEBI_CSPin(int csNum)
Configure the I/O pin for a given Chip Select for the external data bus.
void ConfigureEBI_CS(uint32_t csNum, const EBI_CS_cfg_t &&cfg)
Configure the given Chip Select for the external data bus (rvalue reference version).
Configuration structure for an External Bus Interface (EBI) chip select.
Definition ebi.h:1153
- Example 2: Using a factory function that returns configuration
.ncs_rd_pulse = 10, .nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2, .nwe_setup = 2,
.ncs_wr_pulse = 10, .nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
};
}
void UserMain(void *pd) {
iprintf("CS0 configured using factory function\r\n");
while(1) {
}
}
#define TICKS_PER_SECOND
System clock ticks per second.
Definition constants.h:49
void init()
System initialization. Ideally called at the beginning of all applications, since the easiest Recover...
- Example 3: Chain configuration with std::move
void ConfigureMultipleChipSelects() {
.ncs_rd_pulse = 10, .nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2, .nwe_setup = 2,
.ncs_wr_pulse = 10, .nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
};
iprintf("CS0 and CS1 configured\r\n");
}
uint16_t nwe_cycles
Definition ebi.h:1163
uint16_t nrd_cycles
Definition ebi.h:1162
◆ ConfigureEBI_CS() [2/2]
void ConfigureEBI_CS |
( |
uint32_t | csNum, |
|
|
const EBI_CS_cfg_t & | cfg ) |
#include <ebi.h>
Configure the given Chip Select for the external data bus (lvalue reference version).
Configures an External Bus Interface (EBI) chip select with the specified timing and control parameters. This overload accepts an lvalue reference, allowing configuration with existing configuration objects that may be reused.
This function sets up all timing parameters (setup, pulse, hold times), control signal modes, bus width, and wait state configuration for the specified chip select line.
- Parameters
-
csNum | The EBI Chip Select number to configure (typically 0-3, platform-dependent). |
cfg | Const reference to the configuration structure. The configuration is copied, allowing the original to be reused for other chip selects. |
- Note
- This function should be called after pin configuration functions:
-
All timing parameters in the configuration are specified in EBI clock cycles. Calculate the required values based on your EBI clock frequency and device datasheet.
- Warning
- Incorrect timing configuration can cause data corruption or device malfunction. Always verify timing parameters against the external device datasheet.
-
Ensure the chip select number is valid for your platform. Invalid values may result in undefined behavior.
- See also
- ConfigureEBI_CS(uint32_t, const EBI_CS_cfg_t&&)
-
ConfigureEBI_CSPin()
-
EBI_CS_cfg_t
Expand for Example Usage
Examples
- Example 1: Basic CS configuration with persistent config object
void InitializeExternalMemory() {
.nrd_setup = 2,
.ncs_rd_pulse = 10,
.nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2,
.nwe_setup = 2,
.ncs_wr_pulse = 10,
.nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
};
iprintf("CS0 configured for SRAM\r\n");
}
- Example 2: Reusing configuration for multiple chip selects
void ConfigureMultipleSimilarDevices() {
.ncs_rd_pulse = 10, .nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2, .nwe_setup = 2,
.ncs_wr_pulse = 10, .nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
};
iprintf("CS0, CS1, CS2 configured with identical timing\r\n");
}
- Example 3: Configuration with device-specific variations
void ConfigureMixedDevices() {
.ncs_rd_pulse = 10, .nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2, .nwe_setup = 2,
.ncs_wr_pulse = 10, .nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
};
.ncs_rd_pulse = 15, .nrd_pulse = 15,
.nrd_cycles = 22,
.ncs_wr_setup = 3, .nwe_setup = 3,
.ncs_wr_pulse = 20, .nwe_pulse = 20,
.nwe_cycles = 28,
.tdf_cycles = 3,
};
iprintf("CS0: Fast SRAM, CS1: Slow Flash\r\n");
}
@ EBI_BUS_WIDTH_8
8-bit data bus width (D0-D7)
Definition ebi.h:375
- Example 4: Complete initialization with error checking
bool InitializeEBI_Device(uint32_t csNum,
const EBI_CS_cfg_t &config) {
if (csNum > 3) {
iprintf("Error: Invalid chip select %lu\r\n", csNum);
return false;
}
iprintf("Error: TDF cycles must be 0-15\r\n");
return false;
}
}
}
iprintf("CS%lu configured successfully\r\n", csNum);
return true;
}
void UserMain(void *pd) {
.ncs_rd_pulse = 10, .nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2, .nwe_setup = 2,
.ncs_wr_pulse = 10, .nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
};
if (InitializeEBI_Device(0, myConfig)) {
iprintf("Device ready for operations\r\n");
}
while(1) {
}
}
EBI_CS_RdMode_t rdMode
Definition ebi.h:1169
EBI_CS_WrMode_t wrMode
Definition ebi.h:1168
uint8_t tdf_cycles
Definition ebi.h:1164
- Example 5: Configuration storage and retrieval
void StoreConfiguration(uint32_t csNum,
const EBI_CS_cfg_t &config) {
if (csNum < 4) {
g_csConfigs[csNum] = config;
iprintf("Configuration stored for CS%lu\r\n", csNum);
}
}
void ApplyStoredConfiguration(uint32_t csNum) {
if (csNum < 4) {
iprintf("Applied stored configuration to CS%lu\r\n", csNum);
}
}
void UserMain(void *pd) {
.ncs_rd_pulse = 10, .nrd_pulse = 10,
.nrd_cycles = 15,
.ncs_wr_setup = 2, .nwe_setup = 2,
.ncs_wr_pulse = 10, .nwe_pulse = 10,
.nwe_cycles = 15,
.tdf_cycles = 2,
};
StoreConfiguration(0, sramConfig);
ApplyStoredConfiguration(0);
while(1) {
}
}
- Example 6: Dynamic configuration based on clock frequency
uint32_t setupNs,
uint32_t pulseNs,
uint32_t holdNs)
{
float nsPerCycle = 1000.0f / ebiClockMHz;
uint8_t setupCycles = (uint8_t)((setupNs + nsPerCycle - 1) / nsPerCycle);
uint8_t pulseCycles = (uint8_t)((pulseNs + nsPerCycle - 1) / nsPerCycle);
uint8_t holdCycles = (uint8_t)((holdNs + nsPerCycle - 1) / nsPerCycle);
uint16_t totalCycles = setupCycles + pulseCycles + holdCycles;
.ncs_rd_pulse = pulseCycles, .nrd_pulse = pulseCycles,
.nrd_cycles = totalCycles,
.ncs_wr_setup = setupCycles, .nwe_setup = setupCycles,
.ncs_wr_pulse = pulseCycles, .nwe_pulse = pulseCycles,
.nwe_cycles = totalCycles,
.tdf_cycles = 2,
.rdMode = EBI_WRITE_MODE_NRD
};
}
void InitializeDeviceWithTiming() {
iprintf("Device configured with calculated timing\r\n");
}
◆ ConfigureEBI_CSPin()
void ConfigureEBI_CSPin |
( |
int | csNum | ) |
|
#include <ebi.h>
Configure the I/O pin for a given Chip Select for the external data bus.
This function configures the GPIO pin associated with a specific chip select line on the External Bus Interface (EBI). The chip select pin is configured for proper timing and electrical characteristics to control external memory or peripheral devices connected to the data bus.
- Parameters
-
csNum | The chip select number to configure (typically 0-3 depending on platform). Valid range depends on the specific NetBurner platform being used. |
- Note
- This function should be called before attempting to access any external devices connected to the specified chip select line.
- Warning
- Ensure the chip select number is valid for your platform. Invalid values may result in undefined behavior.
- See also
- ConfigureEBI_NWRPin()
-
ConfigureEBI_NRDPin()
Expand for Example Usage
Examples
- Example 1: Configuring a single chip select for external SRAM
void UserMain(void *pd) {
iprintf("EBI CS0 configured for external memory\r\n");
while(1) {
}
}
- Example 2: Configuring multiple chip selects for different peripherals
void InitializeExternalBus() {
iprintf("External bus configured for 3 devices\r\n");
}
void UserMain(void *pd) {
InitializeExternalBus();
while(1) {
}
}
◆ ConfigureEBI_NRDPin()
void ConfigureEBI_NRDPin |
( |
| ) |
|
#include <ebi.h>
Configure the I/O pin for the active low read (NRD) bus signal.
This function configures the GPIO pin for the NRD (Not Read) signal on the External Bus Interface (EBI). The NRD signal is an active-low control signal that indicates when the bus is performing a read operation from an external device.
- Note
- This function must be called once during initialization before performing any read operations from external devices on the EBI bus.
-
The NRD pin is typically shared across all chip selects on the external bus.
- See also
- ConfigureEBI_CSPin()
-
ConfigureEBI_NWRPin()
Expand for Example Usage
Examples
- Example 1: Basic EBI initialization with read capability
void InitializeEBI() {
iprintf("EBI configured for read/write operations\r\n");
}
void UserMain(void *pd) {
InitializeEBI();
while(1) {
}
}
- Example 2: Read-only external memory configuration
void InitializeReadOnlyMemory() {
iprintf("Read-only EBI device configured on CS2\r\n");
}
void UserMain(void *pd) {
InitializeReadOnlyMemory();
while(1) {
}
}
- Example 3: Complete external bus setup with error checking
bool InitializeExternalBus(int csNum) {
if (csNum < 0 || csNum > 3) {
iprintf("Error: Invalid chip select %d\r\n", csNum);
return false;
}
iprintf("EBI CS%d fully configured\r\n", csNum);
return true;
}
void UserMain(void *pd) {
if (InitializeExternalBus(0)) {
iprintf("External device ready for operations\r\n");
}
while(1) {
}
}
◆ ConfigureEBI_NWRPin()
void ConfigureEBI_NWRPin |
( |
| ) |
|
#include <ebi.h>
Configure the I/O pin for the active low write/read (NWR) bus signal.
This function configures the GPIO pin for the NWR (Not Write) signal on the External Bus Interface (EBI). The NWR signal is an active-low control signal that indicates when the bus is performing a write operation to an external device.
- Note
- This function must be called once during initialization before performing any write operations to external devices on the EBI bus.
-
The NWR pin is typically shared across all chip selects on the external bus.
- See also
- ConfigureEBI_CSPin()
-
ConfigureEBI_NRDPin()
Expand for Example Usage
Examples
- Example 1: Basic EBI initialization with write capability
void InitializeEBI() {
iprintf("EBI configured for read/write operations\r\n");
}
void UserMain(void *pd) {
InitializeEBI();
while(1) {
}
}
- Example 2: Write-only external bus configuration
void InitializeWriteOnlyDevice() {
iprintf("Write-only EBI device configured on CS1\r\n");
}
void UserMain(void *pd) {
InitializeWriteOnlyDevice();
while(1) {
}
}
◆ busWidth
Data bus width configuration.
Specifies whether the external device uses 8-bit or 16-bit data transfers. Must match the physical connection and device capabilities.
- See also
- EBI_CS_BusWidth_t
◆ byteAccess
Byte access mode for 16-bit bus configurations.
Controls how 8-bit accesses are handled on a 16-bit bus. Only relevant when busWidth is set to EBI_BUS_WIDTH_16.
- See also
- EBI_CS_ByteAccess_t
- Note
- This setting is ignored for 8-bit bus configurations.
◆ ncs_rd_pulse
uint8_t EBI_CS_cfg_t::ncs_rd_pulse |
NCS (Chip Select) pulse width during read operations, in clock cycles. Defines how long the chip select remains asserted during a read.
Formula: NCS pulse length = (256 × ncs_rd_pulse[6] + ncs_rd_pulse[5:0]) clock cycles
Range: 0-63 standard (0-16319 with extended bit)
- Note
- The pulse width determines the active time of the signal.
◆ ncs_rd_setup
uint8_t EBI_CS_cfg_t::ncs_rd_setup |
NCS (Chip Select) setup time for read operations, in clock cycles. Defines the time from CS assertion to read signal assertion.
Formula: NCS setup length = (128 × ncs_rd_setup[5] + ncs_rd_setup[4:0]) clock cycles
Range: 0-63 standard (0-8063 with extended bit)
- Note
- This sets when the chip select activates before the read signal.
◆ ncs_wr_pulse
uint8_t EBI_CS_cfg_t::ncs_wr_pulse |
NCS (Chip Select) pulse width during write operations, in clock cycles. Defines how long the chip select remains asserted during a write.
Formula: NCS pulse length = (256 × ncs_wr_pulse[6] + ncs_wr_pulse[5:0]) clock cycles
Range: 0-63 standard (0-16319 with extended bit)
◆ ncs_wr_setup
uint8_t EBI_CS_cfg_t::ncs_wr_setup |
NCS (Chip Select) setup time for write operations, in clock cycles. Defines the time from CS assertion to write signal assertion.
Formula: NCS setup length = (128 × ncs_wr_setup[5] + ncs_wr_setup[4:0]) clock cycles
Range: 0-63 standard (0-8063 with extended bit)
◆ nrd_cycles
uint16_t EBI_CS_cfg_t::nrd_cycles |
Total read cycle length in clock cycles.
The total read cycle length is the complete duration of a read operation, equal to the sum of setup, pulse, and hold times for NRD and NCS signals.
Formula: Read cycle length = (nrd_cycles[8:7] × 256 + nrd_cycles[6:0]) clock cycles
Range: 0-127 standard (0-32639 with extended bits)
Calculation: nrd_cycles = ncs_rd_setup + ncs_rd_pulse + hold_time
- Note
- The hold time is implicit: Hold = nrd_cycles - (setup + pulse)
◆ nrd_pulse
uint8_t EBI_CS_cfg_t::nrd_pulse |
NRD (Read Enable) pulse width, in clock cycles. Defines how long the read enable signal remains asserted.
Formula: NRD pulse length = (256 × nrd_pulse[6] + nrd_pulse[5:0]) clock cycles
Range: 0-63 standard (0-16319 with extended bit)
- Note
- This is typically the minimum access time required by the device.
◆ nrd_setup
uint8_t EBI_CS_cfg_t::nrd_setup |
NRD (Read Enable) setup time, in clock cycles. Defines the delay from CS assertion to read enable assertion.
Formula: NRD setup length = (128 × nrd_setup[5] + nrd_setup[4:0]) clock cycles
Range: 0-63 standard (0-8063 with extended bit)
◆ nWait
NWAIT signal mode for bus cycle extension.
Configures how the external NWAIT signal is used to extend read/write cycles for slow devices. Commonly used with flash memory or variable-speed peripherals.
- See also
- EBI_CS_NWait_t
- Note
- When disabled, all timing is strictly controlled by the configured values.
◆ nwe_cycles
uint16_t EBI_CS_cfg_t::nwe_cycles |
Total write cycle length in clock cycles.
The total write cycle length is the complete duration of a write operation, equal to the sum of setup, pulse, and hold times for NWE and NCS signals.
Formula: Write cycle length = (nwe_cycles[8:7] × 256 + nwe_cycles[6:0]) clock cycles
Range: 0-127 standard (0-32639 with extended bits)
Calculation: nwe_cycles = ncs_wr_setup + ncs_wr_pulse + hold_time
- Note
- The hold time is implicit: Hold = nwe_cycles - (setup + pulse)
◆ nwe_pulse
uint8_t EBI_CS_cfg_t::nwe_pulse |
NWE (Write Enable) pulse width, in clock cycles. Defines how long the write enable signal remains asserted.
Formula: NWE pulse length = (256 × nwe_pulse[6] + nwe_pulse[5:0]) clock cycles
Range: 0-63 standard (0-16319 with extended bit)
- Note
- This is typically the minimum write pulse time required by the device.
◆ nwe_setup
uint8_t EBI_CS_cfg_t::nwe_setup |
NWE (Write Enable) setup time, in clock cycles. Defines the delay from CS assertion to write enable assertion.
Formula: NWE setup length = (128 × nwe_setup[5] + nwe_setup[4:0]) clock cycles
Range: 0-63 standard (0-8063 with extended bit)
◆ rdMode
◆ tdf_cycles
uint8_t EBI_CS_cfg_t::tdf_cycles |
Data Float time - number of clock cycles for the external device to release the data after the rising edge of the read controlling signal.
This represents the time the external device needs to tri-state its outputs after a read operation completes. The SMC always provides one full cycle of bus turnaround after this TDF period.
Valid range: 0-15 clock cycles
- Note
- This prevents bus contention when switching between read and write operations.
-
A value of 0-2 is typical for fast devices; 3-5 for slower devices.
◆ wrMode