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

External memory on a XC16x Board

Hi Everybody,

I'm still experimenting with Infineon's XC161 Starter Kit using the Keil C166 compiler, v4.27 (linker version 4.28). Almost everything I need works OK now, except the external bus controller. Below I'll describe my situation:

Hardware
========

I've connected the RAM to the processor by setting switch S101.8. This is the configuration for the multiplexed mode, so I also switched S103.1 and S103.2 off for 16 bits multiplexed mode.

The CS-lines are enabled by off-switching S102.6 and S102.7. I use 4-bit address lines by setting S102.4 and S102.5.

S102.8 is switched on to use /WR and /BHE as /WRL and /WRH.


Software
========

In the startup file (START_V2.A66) I configured the EBC as follows:


$SET (CONFIG_EBC = 1)
_SAPEN      EQU    4
_CSPEN      EQU    5
_ARBEN      EQU    0
_SLAVE      EQU    0
_EBCDIS     EQU    0
_WRCFG      EQU    1
_BYTDIS     EQU    0
_ALEDIS     EQU    0
_RDYDIS     EQU    0
_RDYPOL     EQU    0
_APDIS      EQU    0
_DHPDIS     EQU    0


CS1 as follows:


$SET (CONFIG_CS1 = 1)
_ADDR1      EQU    0x400000
_SIZE1      EQU    256*KB
_ENCS1      EQU    1
_RDYEN1     EQU    0
_RDYMOD1    EQU    0
_BTYP1      EQU    3
_PHA1       EQU    3
_PHB1       EQU    1
_PHC1       EQU    3
_PHD1       EQU    1
_PHE1       EQU    25
_RDPHF1     EQU    3
_WRPHF1     EQU    3


Maximum bus times to control the RAM, so it isn't a timing problem. In the target options (under 'External Memory") I set the following values for #1:

Start: 0x400000
Size : 0x40000

In my C-code I also set the P6 pins to output.

I've looked over my problem several times but couldn't trace the things going wrong. I also tried other memory configurations (8 bit mux, 8 bit demux and 16 bit demux) but all of them with no success.

Final thing to tell about are the contents of my .M66-file. All data is located in valid areas (I can see vars in the 0x400000 area), but one line is very strange:


  VALUE       PUBLIC SYMBOL NAME               REP   TGR  CLASS   SECTION
=======================================================================
-- cut --
  3F8000H     ?C_NDATABASE                     CONST ---  ---     ---
-- cut --


I don't know if 0x3F8000 should be an address, that is used somewhere else, but IF so, then it's not valid. I didn't configure this value anywhere; it's generated by Keil's Linker.

Well, phiew, that was a lot of writing, so I hope somebody can help me? :)

Kind Regards,
Dennis Ebben

Parents
  • Hello Stefan and Dennis,
    I've got the demuxed memory working, but I feel, there are some timing problems. In my configuration the XC164 is running with 40MHz and I use the memory allocation functions. Sometimes malloc returns a NULL pointer and the memory pool is definitivly not empty, because it is the first call after RESET and init_mempool. With multiplexed memory, I hav'nt seen this problem.
    I use the fast settings from Stefan:
    phase a: 0
    phase b: 1
    phase c: 1
    phase d: 0
    phase e: 1
    phase f: 1 read
    phase f: 0 write
    and I also tried some slower values, with same result.
    Another effect is, that UV2 is crashing down and the ULINK interface shows RUN.
    But maybe it is a temperature problem, it is too hot in Germany at the moment ;-).
    ... the last 10 times it works, but it's not colder ???

    Another problem, I have, is the second serial port from XC164. Everywhere you can read, it is an option for this device, but nowhere I've found a derivative with this option. Has anybody information about this.
    Stefan, you have mentioned the serial EEPROM on the board and your code. Is it possible, to reuse it?
    Thanks and bye
    Steffen

Reply
  • Hello Stefan and Dennis,
    I've got the demuxed memory working, but I feel, there are some timing problems. In my configuration the XC164 is running with 40MHz and I use the memory allocation functions. Sometimes malloc returns a NULL pointer and the memory pool is definitivly not empty, because it is the first call after RESET and init_mempool. With multiplexed memory, I hav'nt seen this problem.
    I use the fast settings from Stefan:
    phase a: 0
    phase b: 1
    phase c: 1
    phase d: 0
    phase e: 1
    phase f: 1 read
    phase f: 0 write
    and I also tried some slower values, with same result.
    Another effect is, that UV2 is crashing down and the ULINK interface shows RUN.
    But maybe it is a temperature problem, it is too hot in Germany at the moment ;-).
    ... the last 10 times it works, but it's not colder ???

    Another problem, I have, is the second serial port from XC164. Everywhere you can read, it is an option for this device, but nowhere I've found a derivative with this option. Has anybody information about this.
    Stefan, you have mentioned the serial EEPROM on the board and your code. Is it possible, to reuse it?
    Thanks and bye
    Steffen

Children
  • Hi Steffen,

    no idea about what goes wrong with the timings, if Dennis not could help you with his experiences I would e-mail my project files for muxed mode ( and so my timings ).
    Please leave your mail-account here.

    I send my SPI-Routines to you, which works
    with a terminal program via ASC0


    Second ASC interface

    You can freely use the second ASC interface.
    The ASC1 is implemented now with all newer derivatives, since Infineon recognized that a second micro line is more daerer than test the second interface on each chip.
    The best way is to develop the ASC routines with DAvE for XC161 and than copy the related routines to your project, since
    the DAvE DIP does not included the second
    ASC at this time.
    Otherwise you can copy the ASC0 files to ASC1 files, but you have to dadapted the
    MAIN.H with the addresses of ASC1 interface.

    Take care to enable the ASC1 device in startup-file. This is one thing that DAvE does wrong !!

    Stefan

  • Hi Stefan,
    I've got the ASC1 not running on my XC164 SK. I've tried your proposals and the software works fine in simulator with settings for XC161.
    I've also measured some signals on MAX232 with oszi. I've seen the transmit datas (T1 IN and T1 OUT in schematics) for configuration ASC0 , but nothing, if I'll use ASC1 (T2 IN, T2 OUT).
    So I have to assume, that ASC1 is not available on my XC164 or on my derivative, may be it's production step dependend.
    My eMail account is
    Steffen.Niekler@gmx.de
    Bye Steffen

  • Hi Steffen,

    please check your account. I e-mailed the files.

    Stefan

  • Hi Stefan,
    thank you for the code, at the moment I could'nt read it, because our mail server is down.
    But I got the second serial interface running. The problem were the right port and alternate settings of ASC1.
    I used the code for XC161, and there are some differences to XC164, because of lower pin count.
    The solution is:

        P3  |= 0x0020;        /* SET PORT 3.5 OUTPUT LATCH (TXD1)               */
        DP3 |= 0x0020;        /* SET PORT 3.5 DIRECTION CONTROL (TXD1 OUTPUT)   */
        DP3 &= 0xFFFD;        /* RESET PORT 3.1 DIRECTION CONTROL (RXD1 INPUT)  */
        ASC1_TIC = 0x80;      /* SET TRANSMIT INTERRUPT FLAG                   */
        ASC1_RIC = 0x00;      /* DELETE RECEIVE INTERRUPT FLAG                 */
        ASC1_BG  = 0x20;      /* SET BAUDRATE TO 38400 BAUD @ 40MHz             */
        ASC1_CON = 0x8011;    /* SET SERIAL MODE                               */
        ALTSEL0P3 |= 0x0022;  /* Configure port pins for serial interface 1    */
    

  • Hi Steffen,

    well done job! ;-}
    As I mentioned I got it too some times before.
    But now you can sure to use your code allways with the new devices.
    If some questions about my code samples, feel free to contact me.

    Stefan