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

Project Settings -> Phytec KC-161

Hi. Where can I find the correct settings for aplications using Phytec KC-161 eval board? Because the arrays are not initialized when the device is running without debug. I'm a biginer and i tryed the following simple code at blinky project from \Boards directory, and the result in Hyper Terminal is not I expect. Thank you.

#include <reg161.h>
#include <stdio.h>
#include <string.h>

void setup_serial();

void main (void)  {
        unsigned int vector[6];
        unsigned int cnt;

        setup_serial();

        for(cnt=0; cnt<6; cnt++){
                vector[cnt] = 1;
                if(vector[cnt] != 1)
                        putchar('!');
                else
                        putchar('1');
//in hyper terminal is displaying six of '!', WHY?
//it must be six of '1'!
        }

        while (1) {
        }
}

void setup_serial(){
  /* init physical memory model */
  BUSCON0 |= 0x003F;    /*; 0 Wait no Delay */

  /* initialize the serial interface     */
  P3  |= 0x0400;        /* SET PORT 3.10 OUTPUT LATCH (TXD)              */
  DP3 |= 0x0400;        /* SET PORT 3.10 DIRECTION CONTROL (TXD OUTPUT)  */
  DP3 &= 0xF7FF;        /* RESET PORT 3.11 DIRECTION CONTROL (RXD INPUT) */
  S0TIC = 0x80;         /* SET TRANSMIT INTERRUPT FLAG                   */
  S0RIC = 0x00;         /* DELETE RECEIVE INTERRUPT FLAG                 */
  S0BG  = 0x19;                 /* SET BAUDRATE TO 19200 BAUD AT 16MHZ           */
  S0CON = 0x8011;       /* SET SERIAL MODE                               */
}

  • You should be able to find the documentation on the Phytec web site. They have a chapter for Memory Models which tells you the settings. If you can't find the manual you could always email them at support@phytec.com

    In the manual you will find something like this (C167 which should work for your C161)…
    ADDRESEL1: 0404h = Memory area 04:0000h - 04:FFFFh
    ( 64 kByte RAM Bank 1 on U10/11)
    ADDRESEL2: 0806h = Memory area 08:0000h - 0B:FFFFh
    ( 256 kByte RAM bank 2 on U14/15)
    ADDRESEL3: 0C06h = Memory area 0C:0000h - 0F:FFFFh
    ( 256 kByte Flash bank 2 on U12/13)
    ADDRESEL4: 1000h = Memory area 10:0000h - 10:0FFFh
    ( 4 kByte free I/O area)
    BUSCON0: 04AFh : Bus active for /CS0 ( Flash bank 1 U8/9)
    BUSCON1: 04AFh : Bus active for /CS1 ( RAM bank 1 U10/11)
    BUSCON2: 04AFh : Bus active for /CS2 ( RAM bank 2 U14/15)
    BUSCON3: 04AFh : Bus active for /CS3 ( Flash bank 2 U12/13)
    BUSCON4: 068Ch : Bus active for /CS4 ( free I/O )
    BUSCON0 - 3: for all 55ns memory devices (0 Waitstate, R/W-Delay, no Tri-state, short ALE, 16-Bit Demultiplexed)
    BUSCON4: for free I/O area (3 Waitstate, RW-Delay, Tri-state Wait 300ns, long ALE, 16-Bit Demultiplexed)

    You need to make sure you have the correct settings in the START167.A66 file that enable the writing of the register and it matches what Phytec has recommended.

    If I were guessing I would say you did not define external memory under the target options. The array vector is most likely stored in Flash therefore it gives you a result of '!' since you cannot just write to Flash.