Hello All,
I have been trying to get past setting the chip selects on the MC68340 CPU. I can program pretty much everything on the CPU, but when I set the "V" flag of the CS0 Base Address Register (bit 0 of the CSBAR0), the CPU freezes. No errors, just freezes. I know this issue is related to the "Global Chip Select" that CS0 defaults to right after reset and before the "V" bit is set. Setting the "V" bit clears the Global Chip Select action of CS0 and switches it to be a "Normal" Chip Select.
I can configure CS1, CS2, and CS3 without issue but they aren't active while the Global Chip Select is active. I have followed the examples in the MC68340 User Manual, have read all of the User Manual Updates, and am unable to get past this point. Not much info or code is available on the net, and I really do need help getting past this step. I'm more of a hardware guy than a programmer, but this seems straightforward.
If I comment out the line that sets the "V" flag of the Chip Select Base Address Register, the remaining code (not posted) continues and seems to work correctly - just can't access any devices in the device map since the chip selects aren't active.
If it helps, I've swapped out CPUs with 25MHz and 16MHz versions both Freescale and Motorola versions, AND I did have the same exact issue on previous revisions of the PCBs. This project has two CPU (the other is a MCF5206) and I have no issues configuring the Chip Selects on the second CPU.
Any help or insight would be appreciated.
Thank You!
I have been trying to get past setting the chip selects on the MC68340 CPU. I can program pretty much everything on the CPU, but when I set the "V" flag of the CS0 Base Address Register (bit 0 of the CSBAR0), the CPU freezes. No errors, just freezes. I know this issue is related to the "Global Chip Select" that CS0 defaults to right after reset and before the "V" bit is set. Setting the "V" bit clears the Global Chip Select action of CS0 and switches it to be a "Normal" Chip Select.
I can configure CS1, CS2, and CS3 without issue but they aren't active while the Global Chip Select is active. I have followed the examples in the MC68340 User Manual, have read all of the User Manual Updates, and am unable to get past this point. Not much info or code is available on the net, and I really do need help getting past this step. I'm more of a hardware guy than a programmer, but this seems straightforward.
If I comment out the line that sets the "V" flag of the Chip Select Base Address Register, the remaining code (not posted) continues and seems to work correctly - just can't access any devices in the device map since the chip selects aren't active.
If it helps, I've swapped out CPUs with 25MHz and 16MHz versions both Freescale and Motorola versions, AND I did have the same exact issue on previous revisions of the PCBs. This project has two CPU (the other is a MCF5206) and I have no issues configuring the Chip Selects on the second CPU.
Any help or insight would be appreciated.
Thank You!
Startup ASM:
BAR EQU $0003FF00 ; Address of Module Base Address Reg.
MODBASE EQU $FFF00000 ; Default Module Base address value
CSAM0 EQU $40 ; chip select 0 mask reg
CSBAR0 EQU $44 ; chip select 0 base reg
CSAM1 EQU $48 ; chip select 1 mask reg
CSBAR1 EQU $4C ; chip select 1 base reg
CSAM2 EQU $50 ; chip select 2 mask reg
CSBAR2 EQU $54 ; chip select 2 base reg
CSAM3 EQU $58 ; chip select 3 mask reg
CSBAR3 EQU $5C ; chip select 3 base reg
ROM_START EQU $00000000 ; ROM Starting Address
ROM_SIZE EQU $0007FF00 ; ROM Size 512KB
RAM_START EQU $40000000 ; RAM Starting Address
RAM_SIZE EQU $000FFF00 ; RAM Size 1MB
IO_1_START EQU $80000000 ; IO1 Starting Address
IO_1_SIZE EQU $00F9FF00 ; IO1 Size
IO_2_START EQU $C0000000 ; IO2 Starting Address
IO_2_SIZE EQU $00F9FF00 ; IO2 Size
SECTION __CODE
__cstart
__START
.even
; =======================================================================
; Disable interrupts
; =======================================================================
MOVE.W #$2700,SR ; disable interrupts
; =======================================================================
; MBAR setup
; =======================================================================
MOVE.L #$7,d0
MOVEC d0,DFC ; source function code = CPU space
MOVE.L #MODBASE+$101,d0 ; MBAR $FFF00000 + AS7=1 (UM Addendum) + V=1
MOVES.L d0,BAR
MOVEA.L #MODBASE,a5 ; SIM40 base
; =======================================================================
; Configure CS0 = ROM, 512 KB, 16 bit, external DACK
; =======================================================================
MOVE.L #ROM_SIZE+$3,(MODBASE+CSAM0) ; CSOR0
MOVE.L #ROM_START+$9,(MODBASE+CSBAR0) ; CSBAR0
; =======================================================================
; Configure CS1 = RAM, $40000000, 4 MB, 16 bit, external DACK
; =======================================================================
MOVE.L #RAM_SIZE+$3,(MODBASE+CSAM1) ; CSOR1
MOVE.L #RAM_START+$1,(MODBASE+CSBAR1) ; CSBAR1
; =======================================================================
; Configure CS2 = I/O, $80000000, 16 MB, 8 bit, external DACK
; =======================================================================
MOVE.L #IO_1_SIZE+$3,(MODBASE+CSAM2) ; CSOR2
MOVE.L #IO_1_START+$1,(MODBASE+CSBAR2) ; CSBAR2
; =======================================================================
; Configure CS3 = I/O, $C0000000, 16 MB, 8 bit, external DACK
; =======================================================================
MOVE.L #IO_2_SIZE+$3,(MODBASE+CSAM3) ; CSOR3
MOVE.L #IO_2_START+$1,(MODBASE+CSBAR3) ; CSBAR3
; =======================================================================
; Configure Clock - External 25MHz with PLL on
; =======================================================================
MOVE.W #$7F00,4(a5)
pll_lock:
MOVE.W 4(a5),d0
BTST #3,d0
BEQ pll_lock
; =======================================================================
; Disable watchdogs
; =======================================================================
MOVE.B #$00,($40,a5) ; software watchdog off
MOVE.W ($6,a5),d0
ANDI.W #$FF7F,d0
MOVE.W d0,($6,a5) ; bus monitor off
