Hallo Bascom user,
es gibt gute Neuigkeiten zu Weihnachten:
Hatte ein paar Tage das Vergnügen, als Beta-Tester tätig zu sein:
Mark Alberts hat mit der letzen Bascom-Revision (1.11.9.7) deutliche Fortschritte für die Unterstützung des Xmega128A1 erzielt. Gegenüber der Vorversion (Anfang Dezember), die faktisch nur USARTC0 unterstützte, werden jetzt alle 8 USARTs angesprochen (Com1..Com8), also auch Com7 wie für Dirk's Xmega-A1-USB board (my favorite!) erforderlich. ADCs und DACs sind bereits voll lauffähig, Eeprom R/W funzt, DMA-Unterstützung ist teilweise verwirklicht, Interrupt-Priorisierung ist da, interne und externe Taktgeber sind konfigurierbar, Event-Handling und 16-Bit Timer/Counter incl. PWM-Synthese muß noch "registernah" selbst gemacht werden.
Hier das originale Source-Snippet mit Anpassung für Xmega-A1-USB eingebaut:
'----------------------------------------------------------------
' (c) 1995-2009, MCS
' xm128A1.bas
' This sample demonstrates the Xmega128A1
'-----------------------------------------------------------------
$regfile = "xm128a1def.dat"
$crystal = 32000000
$hwstack = 64
$swstack = 40
$framesize = 40
'include the following lib and code, the routines will be replaced since they are a workaround
$lib "xmega.lib"
$external _xmegafix_clear
$external _xmegafix_rol_r1014
'$timeout = 8000000 TIMEOUT WILL WORK FOR ALL UARTS
'first enable the osc of your choice
Config Osc = Enabled , 32mhzosc = Enabled
'configure the systemclock
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
Dim N As String * 16 , B As Byte
Config Com7 = 38400 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Config Input7 = Cr , Echo = Crlf ' CR is used for input, we echo back CR and LF
Open "COM7:" For Binary As #7
' ^^^^ change from COM1-COM8
Config Portf = Output
'Config Portf.3 = Output ' TX pin must be output
Config Pinf.2 = Input
Config Portq = Output
Waitms 500
Print #7 , "Xmega revision:" ; Mcu_revid ' make sure it is 7 or higher !!! lower revs have many flaws
Config Eeprom = Mapped ' when using EEPROM , add this config command
'setup the DACA
Config Daca = Enabled , Io0 = Enabled , Channel = Single , Reference = Int1v , Interval = 64 , Refresh = 64
Daca = 4095 '1 V output on porta.2
'Start Daca ' to enabled it
'Stop Daca ' to diabled it
'setup the ADC-A converter
Config Adca = Single , Convmode = Unsigned , Resolution = 12bit , Dma = Off , Reference = Int1v , Event_mode = None , Prescaler = 32 , Ch0_gain = 1 , Ch0_inp = Single_ended , Mux0 = 0 'you can setup other channels as well
Dim Teller As Long
Dim Le As Eram Long ' eram var
Dim L As Long ' normal var
L = &H12345678
Le = L
L = 0
L = Le
Print #7 , Hex(l) 'test if it worked
Dim W As Word, Iby as Byte
Do
W = Getadc(adca , 0)
Print #7 , W
Waitms 500
Iby = Waitkey(#7)
Loop Until Iby = 27
'Achtung: Im ursprüglichen snippet steht noch Loop until Inkey(#1),
'da meckert bei mir allerdings der Compiler, werde ich noch rückmelden.
'configure the priority
'config priority=static|roundrobin,vector=application|boot,HI=enabled|disabled, LO=enabled|disabled,ME=enabled|disabled
Config Priority = Static , Vector = Application , Lo = Enabled
'test an interrupts
On Usartc0_rxc Rxc_isr
Enable Usartc0_rxc , Lo
Enable Interrupts
Dim Tel As Byte
Tel = 65
Do
Teller = 0
'Print #1 , "press ESC key"
'Do
' Tel = Inkey(#1)
' Print #1 , Tel
' Waitms 100
'Loop Until Tel = 27
Tel = Waitkey(#7)
Print #7 , Tel
Input #7 , "name?" , N
Print #7 , N
Print #7 , Teller
Loop
Rxc_isr:
Toggle Portq.3
Incr Teller
Return
-------------------------------
Was braucht man sonst noch:
Die Version 1.11.9.7 ist nur registierten Bascom-Usern zugänglich. Man braucht ein neues LIC-File, das bei www.mcselec.com unter Registration und Update im Main Menu zu finden ist. Danach kann mit dem vorhandenen AutoUpdate Wiz weitergemacht werden.
Es gibt unter Samples/Boot einen Bootloader für den Xmega, der hat bei mir vor ein paar Tagen auf dem Xmega-A1-USB board noch nicht mit dem in Bascom eingebauten Uploader (MCS Bootloader) glatt funktioniert. Werde ihn noch anpassen. Mit Dirk's Programmer geht es aber mindestens genau so schön.
Für das Bootloader-Flashen (oder Direktflashen) sollte man als HW mindestens den AVRISP mkII einsetzen (AVR-Praxis-Shop). Das Update der FW geht mit dem AVR Studio (ab Juliversion, inzwischen gibt es eine Dezemberversion). Da der AVRISP mkii ab Dezemberversion per Kommandozeile aufrufbar ist (auch für PDI) sollte ein Direkteinbau in Bascom gelingen. Wird vermutlich nicht lange dauern, bis diese Option zur Verfügung steht.
Frohe Weihnachten und einen guten Rutsch,
N.
es gibt gute Neuigkeiten zu Weihnachten:
Hatte ein paar Tage das Vergnügen, als Beta-Tester tätig zu sein:
Mark Alberts hat mit der letzen Bascom-Revision (1.11.9.7) deutliche Fortschritte für die Unterstützung des Xmega128A1 erzielt. Gegenüber der Vorversion (Anfang Dezember), die faktisch nur USARTC0 unterstützte, werden jetzt alle 8 USARTs angesprochen (Com1..Com8), also auch Com7 wie für Dirk's Xmega-A1-USB board (my favorite!) erforderlich. ADCs und DACs sind bereits voll lauffähig, Eeprom R/W funzt, DMA-Unterstützung ist teilweise verwirklicht, Interrupt-Priorisierung ist da, interne und externe Taktgeber sind konfigurierbar, Event-Handling und 16-Bit Timer/Counter incl. PWM-Synthese muß noch "registernah" selbst gemacht werden.
Hier das originale Source-Snippet mit Anpassung für Xmega-A1-USB eingebaut:
'----------------------------------------------------------------
' (c) 1995-2009, MCS
' xm128A1.bas
' This sample demonstrates the Xmega128A1
'-----------------------------------------------------------------
$regfile = "xm128a1def.dat"
$crystal = 32000000
$hwstack = 64
$swstack = 40
$framesize = 40
'include the following lib and code, the routines will be replaced since they are a workaround
$lib "xmega.lib"
$external _xmegafix_clear
$external _xmegafix_rol_r1014
'$timeout = 8000000 TIMEOUT WILL WORK FOR ALL UARTS
'first enable the osc of your choice
Config Osc = Enabled , 32mhzosc = Enabled
'configure the systemclock
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
Dim N As String * 16 , B As Byte
Config Com7 = 38400 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Config Input7 = Cr , Echo = Crlf ' CR is used for input, we echo back CR and LF
Open "COM7:" For Binary As #7
' ^^^^ change from COM1-COM8
Config Portf = Output
'Config Portf.3 = Output ' TX pin must be output
Config Pinf.2 = Input
Config Portq = Output
Waitms 500
Print #7 , "Xmega revision:" ; Mcu_revid ' make sure it is 7 or higher !!! lower revs have many flaws
Config Eeprom = Mapped ' when using EEPROM , add this config command
'setup the DACA
Config Daca = Enabled , Io0 = Enabled , Channel = Single , Reference = Int1v , Interval = 64 , Refresh = 64
Daca = 4095 '1 V output on porta.2
'Start Daca ' to enabled it
'Stop Daca ' to diabled it
'setup the ADC-A converter
Config Adca = Single , Convmode = Unsigned , Resolution = 12bit , Dma = Off , Reference = Int1v , Event_mode = None , Prescaler = 32 , Ch0_gain = 1 , Ch0_inp = Single_ended , Mux0 = 0 'you can setup other channels as well
Dim Teller As Long
Dim Le As Eram Long ' eram var
Dim L As Long ' normal var
L = &H12345678
Le = L
L = 0
L = Le
Print #7 , Hex(l) 'test if it worked
Dim W As Word, Iby as Byte
Do
W = Getadc(adca , 0)
Print #7 , W
Waitms 500
Iby = Waitkey(#7)
Loop Until Iby = 27
'Achtung: Im ursprüglichen snippet steht noch Loop until Inkey(#1),
'da meckert bei mir allerdings der Compiler, werde ich noch rückmelden.
'configure the priority
'config priority=static|roundrobin,vector=application|boot,HI=enabled|disabled, LO=enabled|disabled,ME=enabled|disabled
Config Priority = Static , Vector = Application , Lo = Enabled
'test an interrupts
On Usartc0_rxc Rxc_isr
Enable Usartc0_rxc , Lo
Enable Interrupts
Dim Tel As Byte
Tel = 65
Do
Teller = 0
'Print #1 , "press ESC key"
'Do
' Tel = Inkey(#1)
' Print #1 , Tel
' Waitms 100
'Loop Until Tel = 27
Tel = Waitkey(#7)
Print #7 , Tel
Input #7 , "name?" , N
Print #7 , N
Print #7 , Teller
Loop
Rxc_isr:
Toggle Portq.3
Incr Teller
Return
-------------------------------
Was braucht man sonst noch:
Die Version 1.11.9.7 ist nur registierten Bascom-Usern zugänglich. Man braucht ein neues LIC-File, das bei www.mcselec.com unter Registration und Update im Main Menu zu finden ist. Danach kann mit dem vorhandenen AutoUpdate Wiz weitergemacht werden.
Es gibt unter Samples/Boot einen Bootloader für den Xmega, der hat bei mir vor ein paar Tagen auf dem Xmega-A1-USB board noch nicht mit dem in Bascom eingebauten Uploader (MCS Bootloader) glatt funktioniert. Werde ihn noch anpassen. Mit Dirk's Programmer geht es aber mindestens genau so schön.
Für das Bootloader-Flashen (oder Direktflashen) sollte man als HW mindestens den AVRISP mkII einsetzen (AVR-Praxis-Shop). Das Update der FW geht mit dem AVR Studio (ab Juliversion, inzwischen gibt es eine Dezemberversion). Da der AVRISP mkii ab Dezemberversion per Kommandozeile aufrufbar ist (auch für PDI) sollte ein Direkteinbau in Bascom gelingen. Wird vermutlich nicht lange dauern, bis diese Option zur Verfügung steht.
Frohe Weihnachten und einen guten Rutsch,
N.