View previous topic :: View next topic |
Author |
Message |
Kaiser48
Joined: 04 Feb 2005 Posts: 18 Location: Berlin
|
Posted: Tue Nov 18, 2014 10:05 pm Post subject: XMega dont stops to write at XRAM |
|
|
It's my first Project with XMEGA128. I do write data to an external RAM using EBI and XRAM. I'm using only the lower 8 address bits and all things work fine so long
as a use a simple programm to write only a few data to some addresses and the programm ends. There is no endless loop and there are no Subroutines.
As soon as i declare a SUB (only declare it!!!, it's not essentiell to call it), the programm never stops to write data to the external bus.
I can't find the reason!?
[
$regfile = "xm128a1def.dat"
$crystal = 8000000 '8MHz
$hwstack = 64
$swstack = 40
$framesize = 40
$lib "xmega.lib"
$external _xmegafix_clear
$external _xmegafix_rol_r1014
Config Osc = Enabled, 32mhzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 4 , Prescalebc = 1_1 'Internal 32MHz, prescaler = 4
CONFIG XRAM=3PORT, MODESEL0=SRAM, ADRSIZE0=128k, BASEADR0=&h20000, ALE=NOALE, WAITSTATE0=4
$xramsize = &h40000
waitms 1
Dim W As Word
Dim Tiefe As Word
Dim B As Byte
Dim LoTiefe As Byte
Dim HiTiefe As Byte
Const BaseADR = &h20000
Const NullAdres = BaseADR
Const EinsAdres = BaseADR + 1
'Declare Sub Set_PFC(PFC_Wert As Word)
Porth_dirset = &B1111_1111 : Porth = &B1111_0011 'WR, RD, ALE1, ALE2, CS0-3 = output : ALE1 & 2 auf 0 !!!
Portj_dirset = &B1111_1111 : Portj = &B1111_1111
Portk_dirset = &B1111_1111 : Portk = &B1111_1111
Tiefe = &h3FF
LoTiefe = Low(Tiefe)
HiTiefe = High(Tiefe)
Out NullAdres , LoTiefe
Out EinsAdres , HiTiefe
B = 0
W = 0
Do
B = W
Out NullAdres , B
B = High(W)
Out EinsAdres , B
Incr W
Loop until W = 1023
'Sub Set_PFC(PFC_Wert As DWord)
'do nothing
'End Sub
End
]
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Nov 18, 2014 11:41 pm Post subject: |
|
|
when you post code, you can best use the CODE tags. Makes it better readable.
there could be a few reasons. i advise to do a test to see if the processor reboots.
usually i do something like :
Code: | dim i as integer
do
print i
waitms 1000
loop
|
I did not show the config for the com. the idea is that if you check the terminal emulator output, the numbers must be increasing. if not it means the processor resets for some reason.
one of the reasons could be that processor is not programmed properly : use verify option to see if the code matches the image.
if you can not find it, create a sample that works, and that doesn't. then zip them and post them or send to support. _________________ Mark |
|
Back to top |
|
|
laborratte
Joined: 27 Jul 2005 Posts: 299 Location: Berlin
|
Posted: Wed Nov 19, 2014 1:24 am Post subject: |
|
|
you have to end (or endless loop) your program before you define your subs:
Code: | Out EinsAdres , B
Incr W
Loop until W = 1023
End '<-----------------HERE
Sub Set_PFC(PFC_Wert As DWord)
'do nothing
End Sub
|
otherwise you return from a subroutine that wasn't called.
crash. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Nov 19, 2014 10:05 am Post subject: |
|
|
ha, i did not see that laborratte .
you can also use : CONFIG SUBMODE=NEW
which does not put the sub module code at the place you define them. See the help. _________________ Mark |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|