I have an Infineon SK-XC167CI Easy Kit V3 board, soldered with an Infineon XC167CI-32F40F microcontroller. I am using the Keil UVision 3 IDE. The board has been extended to include an external flash ROM module; the AMD AM29F400B unit (512 Kbytes). This external ROM module is wired into the chip select 1 (CS1) signal; port 6, pin 1 (pin 8 on the microcontroller).
I am trying to access the external ROM module, but am not having much success.
I believe that I have the CS1 area mapped onto the XC167s address space starting at 100000h, using the EBCMOD0, EBCMOD1, TCONCS0, FCONCS0, ADDRSEL1, TCONCS1, and FCONCS1 registers.
I am following the instructions given in the AM29F400B data sheet for requesting the manufacturer id and the device id from the flash ROM module.
I think that my problem lies in the way that I have the EBC setup (which I am doing in the start_v2.a66 file) rather than in the way that I am actually forming the address accesses (the flash ROM module interrogation requests), but I could be wrong.
Any direction that you might be able to give me at this point would be extremely gratefully received.
1. Are you sure that CS1 used for flash? 2. Usually flash chips use CS0 area. 3. You adjust bus timing for current CSx in start.a66 file? EBC must be configured before EINT instruction. Look Peripherials configuration in debug mode in Keil IDE.
Hi Oleg - thanks for your reply.
The external flash ROM module was wired to CS1 - deliberately because I wanted to be able to access the whole of the module. However, the XC167 has now been re-wired so that the external flash ROM module is wired to CS0, as you suggest. Even with the module wired to CS0, I am unable to get things working correctly.
I have tried various values in the TCONCS0 register, but the values that I am using right now are :
_PHA0 EQU 0 _PHB0 EQU 0 _PHC0 EQU 0 _PHD0 EQU 0 _PHE0 EQU 2 _RDPHF0 EQU 1 _WRPHF0 EQU 3
and I am adjusting these values in the Start_v2.a66 file prior to issuing an EINIT instruction.
Please tell me what result you see? - wrong data content - do you try to program/erase operation.
What happens is that I perform a set of writes followed by a single read in order to try to establish the manufacturer / device id.
This is the code :
HVAR( unsigned short, t_addr | 0x00 ) = 0xF0 ; /* bus cycle 1 - reset to read */ /* Autoselect command */ HVAR( unsigned short, t_addr | 0x555 ) = 0xAA ; /* bus cycle 1 - unlock step 1 */ HVAR( unsigned short, t_addr | 0x2AA ) = 0x55 ; /* bus cycle 2 - unlock step 2 */ HVAR( unsigned short, t_addr | 0x555 ) = 0x90 ; /* bus cycle 3 - autoselect command */ xyz = HVAR( unsigned short, t_addr | 0x0000 ) ; /* to get manufacturer id */
when I run the code as shown here, I get a class B trap giving an illegal word operand error.
If I change the code to use
HVAR( unsigned char, ...)
the code runs without error, but it does not return what I expect. It returns 0xFF, when I expect 0x01 (as per the AMD data sheet).
HVAR( unsigned short, t_addr | 0x555 ) = 0xAA ; this line is wrong, because you try to access to word with odd adress (0x555). In some cases 0x555 may relace with 0x554. What BUS-widht you use? If 16-bit you must sure that flash mode pulled-up(down) to WORD-mode. And A0 of flash must be connected to A1 MCU. And other adress pins must be coneected to flash with shifting too. If you use 8-bit BUS you may replace unsigned short to unsigned char.
P.S. The most powerfull way - see oscilloscope in adress pins. I speek English so so. I want to tell you my expirience with this problem, but I can't say right :(
Oleg,
Firstly, thank you for your time; it is proving very helpful.
The bus width that we are using is 16 bit.
Your reply has given me a direction to try.
Since yesterday (Thursday) afternoon, I have been playing around with the PLLCON register to alter the speed that the microcontroller is running at. The external oscillator is 8 MHz and as a result of teh settings on the PLLCON, the CPU is running at 40 MHz - I think that this is probably too fast for either the EBC or for the external flash module.
I will double check the wiring for the address pin connection.
When you say "... sure that flash mode pulled-up(down) to WORD-mode." are you talking about a resistor ?
Thank you again !
You can download a Excel spreadsheet to calculate the EBC setting that you need at the Infineon website.
-Chris
Excel link www.infineon.com/.../download.html
Pdf: www.infineon.com/.../download.html
View all questions in Keil forum