View previous topic :: View next topic |
Author |
Message |
pyclan
Joined: 13 Dec 2005 Posts: 48 Location: Russia
|
Posted: Tue Jul 29, 2014 10:43 am Post subject: XRAM + HARD SPI not work!? |
|
|
Hi everyone!
SRAM connected as in the description HELP BASCOM - Adding XRAM to XMEGA using EBI
CY7C1049DV33-10 - 512k x 8
Code: |
$regfile = "xm128A1def.dat"
$crystal = 2000000
$hwstack = 300 ' default use 32 for the hardware stack
$swstack = 300 ' default use 10 for the SW stack
$framesize = 200 ' default use 40 for the frame space
$xramstart = &H4000
$xramsize = &H80000
' All EBI-Ports must be set to OUTPUT
' All Ports, ACTIVE-LOW , must be set to 1 !!!
' All Ports, ACTIVE-HIGH, must be set to 0 !!!
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
Config Xram = 3port , Ale = Ale12 , Sdbus = 8 , Modesel0 = Sram , Adrsize0 = 256b , Waitstate0 = 0 , Baseadr0 = &H10000 , Modesel1 = Sram , Adrsize1 = 512k , Waitstate1 = 0 , Baseadr1 = &H20000
'We enable Low Level Interrupts in static mode
Config Priority = Static , Vector = Application , Lo = Enabled
'SPI_PIN____________________________
Config Pinc.7 = Output 'SCK
Sck Alias Portb.1
Config Pinc.5 = Output 'MOSI
Mosi Alias Portc.5
Config Pinc.6 = Input 'MISO
Miso Alias Pinc.6
Config Pinc.4 = Output
Spi_ss Alias Portc.4
'Set Spi_ss ' Set SPI-SS to
Portc_pin6ctrl = &B00_011_000 ' MISO pin pull up
Config Spic = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk64 , Data_order = Msb
Open "SPIC" For Binary As #12
'TOUCH_PIN__________________________
Config Pinc.1 = Output
Cs_touch Alias Portc.1
Set Cs_touch
Config Pinf.3 = Input
Int_touch Alias Pinf.3 '
Set Int_touch
'BEEP_PIN___________________________
Config Pinr.0 = Output
Beep Alias Portr.0
Do
Set Beep
Reset Cs_touch
Print #12 , 144
Set Cs_touch
Waitms 100
Reset Beep
Wait 1
Loop
End 'end program
|
This code stops at the line Print # 12, 144 EBI - SRAM, DISPLAY work, SPI not work and also in the simulator.
If you comment out $xramstart = &H4000, SPI works, EBI - SRAM, DISPLAY not work.
What could be the problem?
Thanks,
Ruslan.
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Jul 29, 2014 12:18 pm Post subject: |
|
|
it might be a problem of huge ram which uses rampX.
check if your xmega.lib contains this code :
Code: |
[_XSPI]
_SPI2BASE:
;translate the SPI numbers passed in softstack to the base address
; SPI base is usual 8C0,9C0,AC0,BC0 but for the E series this is 8E0
; Ld r23,y+ ; pop SPI number 0-3 back from the stack
_SPI2BASE_NI: ; when called direct, R23 must be loaded with the SPI number 0-3
#IF _HUGE
Clr R26 ; page address
Out RAMPX,R26
#ENDIF
* ldi r26,lbyte(_SPI_BASE); base address LSB $C0
Ldi r27,8 ; base MSB
add r27,r23 ; add SPI, registers now point to CTRL register
Ret |
especial the part:
#IF _HUGE
Clr R26 ; page address
Out RAMPX,R26
#ENDIF _________________ Mark |
|
Back to top |
|
|
pyclan
Joined: 13 Dec 2005 Posts: 48 Location: Russia
|
Posted: Tue Jul 29, 2014 12:55 pm Post subject: |
|
|
Hi Mark!
Yes library provides.
comment = AVR XMEGA library
libversion = 2.0.7.7
date = 21 July 2011
Was as follows:
Code: | [_XSPI]
_SPI2BASE:
;translate the SPI numbers passed in softstack to the base address
; SPI base is usual 8C0,9C0,AC0,BC0 but for the E series this is 8E0
; Ld r23,y+ ; pop SPI number 0-3 back from the stack
_SPI2BASE_NI: ; when called direct, R23 must be loaded with the SPI number 0-3
* ldi r26,lbyte(_SPI_BASE); base address LSB $C0
Ldi r27,8 ; base MSB
add r27,r23 ; add SPI, registers now point to CTRL register
#IF _HUGE
Clr R26 ; page address
Out RAMPX,R26
#ENDIF
Ret |
Replaced by your code. Everything works.
Thanks,
Ruslan. |
|
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
|
|