Difference between revisions of "IMX27-Spartan3A interface description"

From ArmadeusWiki
Jump to: navigation, search
Line 1: Line 1:
 
  {{Under_Construction}}
 
  {{Under_Construction}}
 +
== Introduction ==
 
This article describe the bus interface configuration to communicate between i.MX27 processor and Spartan3A FPGA.
 
This article describe the bus interface configuration to communicate between i.MX27 processor and Spartan3A FPGA.
 +
 +
== Simplified view ==
  
 
[[image:Imx27-spartan3A.jpg|700px|center|thumb|'''figure 1''' - ''i.MX27-Spartan3A bus description'']]
 
[[image:Imx27-spartan3A.jpg|700px|center|thumb|'''figure 1''' - ''i.MX27-Spartan3A bus description'']]
Line 6: Line 9:
 
Figure 1 is a simplified view of [[Datasheet#APF27 | apf27 schematics]] (page 11). Signals are :
 
Figure 1 is a simplified view of [[Datasheet#APF27 | apf27 schematics]] (page 11). Signals are :
 
 
* CLKO: Clock generated by i.MX. Used as general clock by the FPGA.
+
* '''DATA[15:0]''': Data bus.  
* DATA[15:0]: Data bus.  
+
* '''ADDR[12:1]''': Address bus. All access are down in 16bits, then pin 0 is not used and not plugged.
* ADDR[12:1]: Address bus. All access are down in 16bits, then pin 0 is not used and not plugged.
+
 
* CS4N_DTACK: Chip select 4 (0xD400_0000 to 0xD5FF_FFFF ) or Data Transmit ACKnowledge. This signal can be used as DTACK for asynchronous access with chip select 5.
 
* CS4N_DTACK: Chip select 4 (0xD400_0000 to 0xD5FF_FFFF ) or Data Transmit ACKnowledge. This signal can be used as DTACK for asynchronous access with chip select 5.
 
* '''CS5N''': Chip select 5 (0xD600_0000 to 0xD7FF_FFFF ). Configured by default for FPGA communication.
 
* '''CS5N''': Chip select 5 (0xD600_0000 to 0xD7FF_FFFF ). Configured by default for FPGA communication.
 
* CS1N: Chip select 1 (0xC800_0000 to 0xCFFF_FFFF ).
 
* CS1N: Chip select 1 (0xC800_0000 to 0xCFFF_FFFF ).
* EB0N, EB1N: For Enable Byte, write signal for lower byte and upper byte on data bus.  
+
* '''EB0N''', EB1N: For Enable Byte, write signal for lower byte and upper byte on data bus.  
* OEN: For Output Enable bit, read signal.  
+
* '''OEN''': For Output Enable bit, read signal.  
 
* DMA_GRANT#: Signals to use DMA on i.MX.
 
* DMA_GRANT#: Signals to use DMA on i.MX.
 
* DMA_REQ#: Signals to use DMA on i.MX.
 
* DMA_REQ#: Signals to use DMA on i.MX.
* ''FPGA_INIT'': Not part of i.MX27 WEIM bus but used by default for interrupts (GPIO PF12).
+
Not part of WEIM bus :
 
+
* '''CLKO''': Clock generated by i.MX. Used as general clock by the FPGA.
 +
* FPGA_INIT: Not part of i.MX27 WEIM bus but used by default for interrupts (GPIO PF12).
  
 +
Signals in '''bold''' are signals used in default configuration.
 
Some others signals are used only for fpga configuration. For more informations about the FPGA wiring, see the [[Datasheet#APF27 | APF27 schematics]] and the [http://cache.freescale.com/files/32bit/doc/ref_manual/MCIMX27RM.pdf?fsrch=1&WT_TYPE=Reference%20Manuals&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation&sr=2 i.MX27 reference manual], especially the WEIM chapter.
 
Some others signals are used only for fpga configuration. For more informations about the FPGA wiring, see the [[Datasheet#APF27 | APF27 schematics]] and the [http://cache.freescale.com/files/32bit/doc/ref_manual/MCIMX27RM.pdf?fsrch=1&WT_TYPE=Reference%20Manuals&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation&sr=2 i.MX27 reference manual], especially the WEIM chapter.
 +
 +
== Default configuration on CS5N ==
 +
 +
=== Clock ===
 +
 +
The clock used to clock the fpga is CLK0 and is configured to '''100 MHz'''.
 +
 +
=== Chip select ===
 +
 +
By default the chip select 5 (CS5N) is used for communication. The address domain corresponding to this chip select can be found in i.MX27 reference manual in chapter 2 (Secondary AHB Port 2 Memory Map page 129).
 +
{| border="1" cellpadding="5" cellspacing="0" align="center"
 +
|- style="background:#efefef;" align="center"
 +
! Start Address !! End Address !! Size !! Region
 +
|- align="center"
 +
| 0xC800 0000 || 0xCFFF FFFF || 128M ||  WEIM External Memory (CS1)
 +
|- align="center"
 +
| 0xD400 0000 || 0xD5FF FFFF || 32M ||  WEIM External Memory (CS4)
 +
|- align="center"
 +
| '''0xD600 0000''' || '''0xD7FF FFFF''' || '''32M''' ||  '''WEIM External Memory (CS5)'''
 +
|}
 +
It's possible to use the other chip select (CS1 and CS4) to extend memory domain or to use different timing configuration with the same Address/Data bus signals.
 +
The default bus configuration for the APF27 can be found in the file apf27.h in u-boot sources : buildroot/target/device/armadeus/apf27/apf27-u-boot-1.3.4.h
 +
 +
Especially these lines :
 +
<source lang="c">
 +
/* FPGA 16 bit data bus */
 +
#define CFG_CS5U_VAL 0x00000600
 +
#define CFG_CS5L_VAL 0x00000D01
 +
#define CFG_CS5A_VAL 0
 +
</source>
 +
 +
{{Note| Do not forget to do :
 +
<pre class="host">
 +
$ make u-boot-dirclean
 +
$ make
 +
</pre>
 +
To test your modification under the ''apf27-u-boot-1.3.4.h'' file
 +
}}
 +
 +
It is not necessary to modify apf27.h file and recompile U-Boot for WEIM timings test, register can be read/written ''via'' [http://www.denx.de/wiki/view/DULG/UBootCmdGroupMemory#Section_5.9.2.8. U-Boot] or [[FPGA_register | Linux]].
 +
To access these register with U-Boot or Linux, use the address given under the reference manual in WEIM register descriptions (17.5.3 Register Descriptions).
 +
 +
=== Timings ===
 +
 +
Following chronograms represents WEIM read and write configured for APF27.
 +
 +
[[image:Imx27_sp3_write_timings.jpeg|700px|center|thumb|'''figure 2''' - ''WEIM Write timings'']]
 +
[[image:Imx27_sp3_read_timings.jpeg|700px|center|thumb|'''figure 3''' - ''WEIM Read timings'']]
 +
 +
=== FPGA side ===
 +
 +
By default, the wishbone bus is used under the spartan3A fpga. Then a WEIM to Wishbone wrapper is used, this wrapper is available under POD default libraries in wrappers lib. The component is named imx27_wb16_wrapper.
 +
 +
== The FPGA interrupt ==
 +
 +
By default under [http://periphondemand.sourceforge.net/ POD] the pin '''FPGA_INIT''' (PF12) is used for the interrupts manager ''irq_mngr''. For simple user application the gpio can be used with the [[GPIOlib]] interface, the gpio number will then be (6-1)x32+12 = '''172'''.
 +
 +
Note : With default apf27 kernel 2.6.29.x the GPIOlib can use interrupt event, but can't configure it with ''/sys/class/gpio/gpio172/edge'' file. Interrupt must be configured under the kernel sources. The ''/sys/class/gpio/gpio172/edge'' file can be use only with [[APF9328_and_APF27_migration_to_Linux_2.6.36 | kernel 2.6.38.x]].

Revision as of 11:53, 20 January 2012

Page under construction... 

Construction.png Informations on this page are not guaranteed !!

Introduction

This article describe the bus interface configuration to communicate between i.MX27 processor and Spartan3A FPGA.

Simplified view

figure 1 - i.MX27-Spartan3A bus description

Figure 1 is a simplified view of apf27 schematics (page 11). Signals are :

  • DATA[15:0]: Data bus.
  • ADDR[12:1]: Address bus. All access are down in 16bits, then pin 0 is not used and not plugged.
  • CS4N_DTACK: Chip select 4 (0xD400_0000 to 0xD5FF_FFFF ) or Data Transmit ACKnowledge. This signal can be used as DTACK for asynchronous access with chip select 5.
  • CS5N: Chip select 5 (0xD600_0000 to 0xD7FF_FFFF ). Configured by default for FPGA communication.
  • CS1N: Chip select 1 (0xC800_0000 to 0xCFFF_FFFF ).
  • EB0N, EB1N: For Enable Byte, write signal for lower byte and upper byte on data bus.
  • OEN: For Output Enable bit, read signal.
  • DMA_GRANT#: Signals to use DMA on i.MX.
  • DMA_REQ#: Signals to use DMA on i.MX.

Not part of WEIM bus :

  • CLKO: Clock generated by i.MX. Used as general clock by the FPGA.
  • FPGA_INIT: Not part of i.MX27 WEIM bus but used by default for interrupts (GPIO PF12).

Signals in bold are signals used in default configuration. Some others signals are used only for fpga configuration. For more informations about the FPGA wiring, see the APF27 schematics and the i.MX27 reference manual, especially the WEIM chapter.

Default configuration on CS5N

Clock

The clock used to clock the fpga is CLK0 and is configured to 100 MHz.

Chip select

By default the chip select 5 (CS5N) is used for communication. The address domain corresponding to this chip select can be found in i.MX27 reference manual in chapter 2 (Secondary AHB Port 2 Memory Map page 129).

Start Address End Address Size Region
0xC800 0000 0xCFFF FFFF 128M WEIM External Memory (CS1)
0xD400 0000 0xD5FF FFFF 32M WEIM External Memory (CS4)
0xD600 0000 0xD7FF FFFF 32M WEIM External Memory (CS5)

It's possible to use the other chip select (CS1 and CS4) to extend memory domain or to use different timing configuration with the same Address/Data bus signals. The default bus configuration for the APF27 can be found in the file apf27.h in u-boot sources : buildroot/target/device/armadeus/apf27/apf27-u-boot-1.3.4.h

Especially these lines :

/* FPGA 16 bit data bus */
#define CFG_CS5U_VAL	0x00000600
#define CFG_CS5L_VAL	0x00000D01
#define CFG_CS5A_VAL	0
Note Note: Do not forget to do :
$ make u-boot-dirclean
$ make

To test your modification under the apf27-u-boot-1.3.4.h file


It is not necessary to modify apf27.h file and recompile U-Boot for WEIM timings test, register can be read/written via U-Boot or Linux. To access these register with U-Boot or Linux, use the address given under the reference manual in WEIM register descriptions (17.5.3 Register Descriptions).

Timings

Following chronograms represents WEIM read and write configured for APF27.

figure 2 - WEIM Write timings
figure 3 - WEIM Read timings

FPGA side

By default, the wishbone bus is used under the spartan3A fpga. Then a WEIM to Wishbone wrapper is used, this wrapper is available under POD default libraries in wrappers lib. The component is named imx27_wb16_wrapper.

The FPGA interrupt

By default under POD the pin FPGA_INIT (PF12) is used for the interrupts manager irq_mngr. For simple user application the gpio can be used with the GPIOlib interface, the gpio number will then be (6-1)x32+12 = 172.

Note : With default apf27 kernel 2.6.29.x the GPIOlib can use interrupt event, but can't configure it with /sys/class/gpio/gpio172/edge file. Interrupt must be configured under the kernel sources. The /sys/class/gpio/gpio172/edge file can be use only with kernel 2.6.38.x.