HCS12 External Memony in Narrow Mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS12 External Memony in Narrow Mode

1,633 Views
ElMaia
Contributor I
Hi,

I'm  trying to change from Normal Single Chip to Normal Expanded Narrow but only data outs in External Bus, the address doesn't appear.

The code I use to change follow:

// Until here I'm in Normal Single Chip

      PEAR = 0x0C;   // LSTRB ? (Bit 3)
      EBICTL = 0x01; // ESTR
      MISC = 0x07;   // 1:1 Clock; $4000-7FFF; Internal Flash
      MODE =  0xA8;  // MOD CBA ; 0 ; Visivel ; 0 ; K ; E

// Try access external address

      for (;:smileywink:
        *((char *)0x4000) = a++;

Using a logic analyzer, the data appear in PORTA but nothing in PORTB. The address doesn't appear nether PORTB nor PORTA.

If you have a code that could help me, I would be grateful.

Thanks.

Leandro Maia
Labels (1)
0 Kudos
Reply
1 Reply

492 Views
blood
Contributor III
Check what state the MODA line is held at for startup as that can stop you from changeing modes.
Also check what addresses you expect to be mapped for the external device. On the device I use (9S12E256) the external memory is mapped in the normal paged area of 0x8000 to 0xBFFF.
 
The assembly code I use for setting the mode is
        ; enable read write pin
        ldaa    #RDWE
        staa    PEAR
        ; set mode to normal expanded narrow mode
        ldaa    #MODC+MODA
        staa    MODE
        ; turn on eclk stretching
        bset    MISC,EXSTR1+EXSTR0
 
After that if I set PPAGE to '0' then addresses 0x8000 to 0xBFFF are on the external bus.
0 Kudos
Reply