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

XC167 and external flash ROM module over EBC

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.

Parents
  • Hi Simon,

    I created a project with this exact code sequence for the Keil MCB-XC167 board. The board contains an AM29F160DT, configured in word mode on /CS0. The clock is configured for 40MHz and here is what I get back after running the code from internal Flash (0xC00000):
    0x0000: 0x0001
    0x0002: 0x22D2

    So manufacturer ID is 1, and the device ID is 0x22D2 just as the data sheet specifies.

    I could send you the complete project if interested.

    -Chris

Reply
  • Hi Simon,

    I created a project with this exact code sequence for the Keil MCB-XC167 board. The board contains an AM29F160DT, configured in word mode on /CS0. The clock is configured for 40MHz and here is what I get back after running the code from internal Flash (0xC00000):
    0x0000: 0x0001
    0x0002: 0x22D2

    So manufacturer ID is 1, and the device ID is 0x22D2 just as the data sheet specifies.

    I could send you the complete project if interested.

    -Chris

Children
  • Just a comment to the addressing that seems to be confusing. Have a look to the schematic from Keil to see how to connect word memory to the external bus.

    http://www.keil.com/mcbxc167/mcbxc167-schematics.pdf

    You will see that A0 of the XC167 is not connected because you are reading words (A1 from the XC167 is connected to A0 of the AMD, and so forth). This is why you need to make the adjustment to the address from the perspective of the XC167 not for AMD. So when you write 0x0AAA you are indeed writing 0x0555 to the AMD. The XC167 will not allow word read/writes to odd addresses (you will get a trap).

    Hope this helps.

    -Chris

  • Hi Chris,

    Thank you very much for your help ! I was not in work yesterday (Wednesday), so have only now got around to replying.

    Your offer of the project which you have set up is much appreciated. My email address is simon.may (at) apdcomms.com

    With luck I should be able to see what it is that I am doing wrong, and when I figure that out, I will post back here to clarify.

    Thanks,

    Simon

  • As a result of Chris's project I now have this working.

    The main item which seemed to be affecting how my code was working was that in my start_v2.a66 I had CS7 (the LXBus) enabled. When I disabled this, the code started to work.

    I have not investigated this to try to work out why this should be.

    Having said that, this morning, (Friday) I have the code working whether CS7 is enabled OR disabled.

    At this point I am not sure that I mind which way things are - I am just happy that it is working.

    As I do not see that I will be using the CS7 right now, I will leave it disabled.

    Chris, and Oleg - both, many, many thanks for your help.

    Yours,

    Simon May

  • As a result of some problems which I have been having over the last few days, I wanted to post a short explanation of what I have got set up, and items which should be checked to ensure smooth operation !

    Firstly, the hardware :
    I have an XC167CI-32F soldered onto an Infineon starter kit
    the starter kit has an 8 MHz external crystal
    in addition there is an AMD (Spansion) AM29F400B-70 external flash ROM module soldered on to the board
    the external flash ROM is wired into 'word' mode
    the external flash ROM is wired as a 16-bit demultiplexed bus
    the external flash ROM is wired on CS0
    the address lines of the XC167 are mapped to the address lines of the AM29F400B as specified in the AMD data sheet, ie: A1 from the XC167 is connected to A0 of the AMD, and so forth

    Secondly, the start up code. In start_v2.a66 :

    PLLCON
    .PLLODIV EQU 4
    .PLLIDIV EQU 0
    .PLLVB EQU 1
    .PLLMUL EQU 24
    .PLLCTRL EQU 3
    .PLLWRI EQU 0
    /* these values give a system clock of 40 MHz (on an 8 MHz crystal), but check that VCO is within sensible limits */

    EBCMOD0
    .SAPEN EQU 4
    .CSPEN EQU 5
    .ARBEN EQU 0
    .EBCDIS EQU 0
    .WRCFG EQU 0
    .BYTDIS EQU 0
    .ALEDIS EQU 0
    .RDYDIS EQU 1
    .RDYPOL EQU 0

    EBCMOD1
    .APDIS EQU 0
    .A0PDIS EQU 0
    .ALPDIS EQU 0
    .DHPDIS EQU 0
    .WRPDIS EQU 0

    FCONCS0
    .ENCS0 EQU 1
    .RDYEN0 EQU 0
    .RDYMOD0 EQU 0
    .BTYP0 EQU 2

    TCONCS0
    .PHA0 EQU 0
    .PHB0 EQU 1
    .PHC0 EQU 3
    .PHD0 EQU 1
    .PHE0 EQU 8
    .RDPHF0 EQU 3
    .WRPHF0 EQU 3

    Lastly, the actual software.

    The specifics of the writes / reads which need to be issued are detailed in the AMD data sheet, so I will not go into them here other than to say that when composing an address to use from the point of view of the XC167, if the AMD data sheet says that it needs an access to take place at address 0xAAA, then the software must use the base address of the flash ROM module from the point if view of the XC167 (which, if wired to CS0, will be 0x0 ) added to the address that the AM29F400B expects (for instance, 0xAAA) bit shift one position to the left. Thus

    AMD expects to see 0xAAA
    XC167 must access ( base_address + ( 0xAAA << 1 ) )