View previous topic :: View next topic |
Author |
Message |
unzeitig
Joined: 31 Jan 2008 Posts: 25
|
Posted: Mon Jan 11, 2016 4:10 pm Post subject: ATXMEGA Showpice problem |
|
|
I would like use Showpice in ATXMEGA project. As you see in Example1 it works well with ATMEGA128 but neither with ATXMEGA128A1U nor with ATXMEGA128A3U.
There is probably something regarding EEPROM mapping but I can not find it.
Can anybody help me?
[code]'************* ATMEGA128 ******************* EXAMPLE1
$regfile = "M128DEF.DAT"
$hwstack = 64
$swstack = 64
$framesize = 64
$baud1 = 115200
$lib "adr2.lib"
$eepromhex
'---------------------------------------------------------------
$lib "glcdeadogm128x6.lbx"
Config Graphlcd = 128 * 64eadogm , Cs1 = Porte.7 , A0 = Porte.4 , Si = Porte.2 , Sclk = Porte.3 , Rst = Porte.6
Const Crystalfrekq = 14745600
$crystal = Crystalfrekq
$eeprom
Pic1:
$bgf "Picture1.bgf"
Pic2:
$bgf "Picture2.bgf"
$data
Do
Cls
Showpice 0 , 0 , Pic1
Waitms 500
Showpice 0 , 0 , Pic2
Waitms 500
Loop
'works well
'---------------------------------------------------------------
'---------------------------------------------------------------
'---------------------------------------------------------------
'************* ATXMEGA128A1U or ATXMEGA128A3U ******************* EXAMPLE2
'$regfile = "xm128a1udef.dat"
$regfile = "xm128a3udef.dat"
Const Crystalfrekq = 32000000
$crystal = Crystalfrekq
$hwstack = 64
$swstack = 64
$framesize = 64
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
Config Osc = Disabled , 32mhzosc = Enabled , 32khzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'CPU Clock = 32MHz
Config Eeprom = Quick 'or Mapped - Setup memory mode for EEPROM in XMEGA
Bitwait Osc_status.1 , Set 'Check if 32MHz Oscillator is ready
Bitwait Osc_status.2 , Set 'Check if internal 32.768 KHz Oscillator is ready
Osc_dfllctrl.0 = 0
Dfllrc32m_ctrl.0 = 1 'enable
$eepromhex
'---------------------------------------------------------------
$lib "glcdeadogm128x6.lbx" ' specify the used lib
Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled , Hi = Enabled
Config Graphlcd = 128 * 64eadogm , Cs1 = Portj.1 , A0 = Porth.5 , Si = Porth.1 , Sclk = Porth.3 , Rst = Porth.7
$eeprom
Pic1:
$bgf "Picture1.bgf"
Pic2:
$bgf "Picture2.bgf"
$data
Do
Cls
Showpice 0 , 0 , Pic1
Waitms 500
Showpice 0 , 0 , Pic2
Waitms 500
Loop
'doesn't work
'---------------------------------------------------------------
'---------------------------------------------------------------
'---------------------------------------------------------------
'************* ATXMEGA128A1U or ATXMEGA128A3U ******************* EXAMPLE3
'$regfile = "xm128a1udef.dat"
$regfile = "xm128a3udef.dat"
Const Crystalfrekq = 32000000
$crystal = Crystalfrekq
$hwstack = 64
$swstack = 64
$framesize = 64
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
Config Osc = Disabled , 32mhzosc = Enabled , 32khzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'CPU Clock = 32MHz
Bitwait Osc_status.1 , Set 'Check if 32MHz Oscillator is ready
Bitwait Osc_status.2 , Set 'Check if internal 32.768 KHz Oscillator is ready
Osc_dfllctrl.0 = 0
Dfllrc32m_ctrl.0 = 1 'enable
'---------------------------------------------------------------
$lib "glcdeadogm128x6.lbx" ' specify the used lib
Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled , Hi = Enabled
Config Graphlcd = 128 * 64eadogm , Cs1 = Portj.1 , A0 = Porth.5 , Si = Porth.1 , Sclk = Porth.3 , Rst = Porth.7
Cls
Showpic 0 , 0 , Pic1
Do
Loop
Pic1:
$bgf "Picture1.bgf"
'works well
'---------------------------------------------------------------
'---------------------------------------------------------------
'---------------------------------------------------------------[/code]
[b][color=red](BASCOM-AVR version : 2.0.7.8 )[/b][/color] |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Mon Jan 11, 2016 4:15 pm Post subject: Test bgf in flash? |
|
|
Removed |
|
Back to top |
|
|
Mrshilov
Joined: 24 Jan 2009 Posts: 314 Location: Russia
|
Posted: Mon Jan 11, 2016 7:10 pm Post subject: |
|
|
Try this:
Code: | Config Vport0 = J : Data_disp_low Alias Port0
Config Porta = Output
Config Vport1 = H : Data_disp_high Alias Port1
Config Portb = Output
Config Graphlcd = 128 * 64eadogm , Cs1 = Port0.1 , A0 = Port1.5 , Si = Port1.1 , Sclk = Port1.3 , Rst = Port1.7 |
|
|
Back to top |
|
|
unzeitig
Joined: 31 Jan 2008 Posts: 25
|
Posted: Mon Jan 11, 2016 7:47 pm Post subject: |
|
|
Unfortunatelly result is little bit different but still bad.
When I use following statement Showpic shows Pic2 after reset, after Showpice is display black. In second loop and others LCD is always black. There is something strange.
$eeprom
Pic1:
$bgf "Picture1.bgf"
$data
Do
Cls
Showpic 0 , 0 , Pic2
Lcdat 1 , 1 , "TEST1"
Waitms 500
Showpice 0 , 0 , Pic1
Waitms 500
Lcdat 8 , 1 , "TEST2"
Waitms 500
Loop
Pic2:
$bgf "Picture2.bgf" |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Jan 18, 2016 4:10 pm Post subject: |
|
|
it seems xmega does not support this.
you can add it :
- open xmega.lib
- search this code :
_ReadEEPROM_XMEGA:
And change R24 into R0 :
Rcall _CheckEpromReady ; check and set address
Ld R0,z+ ; get byte
St X+,R0 ; store in variable
Dec R25 ; number of bytes -1
- then save the lib and try again. _________________ Mark |
|
Back to top |
|
|
unzeitig
Joined: 31 Jan 2008 Posts: 25
|
Posted: Mon Jan 18, 2016 4:59 pm Post subject: |
|
|
Hello Mark,
it is better now, display is not freezed after Showpice as before, but Showpice is not performed properly still. After Showpice is display clear and in upper part is black strip - unfortunately it is not part of picture.
Do you have any other idea? I thing it is right direction Showpice problem is solved.
Thank you for your help.
Regards
Petr |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Jan 18, 2016 9:08 pm Post subject: |
|
|
please make the program simpler : without interrupts
- also : use the same BGF file for both showpic and showpice
- upload the actual project files (zipped)
- is the bgf data correct loaded into the eeprom? did you verify that? _________________ Mark |
|
Back to top |
|
|
unzeitig
Joined: 31 Jan 2008 Posts: 25
|
Posted: Tue Jan 19, 2016 10:15 am Post subject: |
|
|
Hello Mark,
there is very simple testing programm enclosed.
I have two possibilities to try Showpice on different boards - atxmega128a1u and atxmega128a3u.
1.atxmega128a3u from my production, JTAGICE3 programmer
After loading programm eeprom stay empty
Showpic in first loop displays on lcd right picture
Showpice displays "china font"
Showpic in second and other loop displays on lcd mirrored picture
Showpice displays "china font"
After I load to eeprom right picture
Showpic displays on lcd right picture
Showpice displays "china font" again
2.atxmega128a1u with usb AVRISP mkII driver or JTAGICE3 programmer, using ATMEL Flip too
After loading programm eeprom stay empty
Showpic in first loop displays on lcd right picture
Showpice displays black lcd
Showpic in second and other loop displays on lcd mirrored picture
Showpice displays black lcd
After I load to eeprom right picture
Showpic displays on lcd right picture
Showpice displays black lcd
With usb AVRISP mkII driver I can not directly write to eeprom. I do not why, but with JTAGICE3 it is possible.
Regards
Petr |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Jan 19, 2016 3:17 pm Post subject: |
|
|
you need to change in xmega.lib this:
_CheckEpromReady:
lds r1,nvm_status ; get status
sbrc r1,7 ; skip ik cleared
at the moment is uses r23 so you need to change it to r1. r23 is used as a flag for indicating flash/eeprom. _________________ Mark |
|
Back to top |
|
|
unzeitig
Joined: 31 Jan 2008 Posts: 25
|
Posted: Tue Jan 19, 2016 4:09 pm Post subject: |
|
|
When I let eeprom empty, Showpic image is still mirrored after one loop and Showpice is changed against it was before - regular pattern setting in whole display - it is better than before.
When I load picture to eeprom Showpic image is right but Showpice causes regular pattern in whole display is little bit changed against when eeprom was empty.
Still some registers are probably wrong.
Regards
Petr |
|
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
|
|