View previous topic :: View next topic |
Author |
Message |
PeterM
Joined: 09 Jun 2008 Posts: 118
|
Posted: Wed Jul 04, 2012 6:31 pm Post subject: Xmega 128A1 Speed - fixed - false alarm |
|
|
To any Xmega Experts
Would you expect an Xmega128A1 with a Internal 32MHz clock runing twice as slow
(actualy more) than a Atmega328P using an 20MHz external crystal ?
Xmega settings
$regfile = "xm128A1def.dat"
$crystal = 32000000
Config Osc = Enabled, 32MHZOSC = Enabled, PLLOSC=ENABLED
Config Sysclock = 32MHZ , Prescalea = 1 , Prescalebc = 1_1
I thought maybe fuse settings but could not see anything else wrong.
I am doing a very fast serial bit bang method (roughly 450Kb/s), I am achieving this
without any problem in assembler using only about 4 NOP's for
a BIT period with the atmega328P yet I cannot achieve this with the Xmega1281. _________________ Peter
Last edited by PeterM on Thu Jul 05, 2012 11:21 am; edited 1 time in total |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Jul 04, 2012 8:36 pm Post subject: |
|
|
i do not expect that. but when using xmega you should know that all ports have an extended address. this means that instructions like cbi/sbi ,etc. do not work.
here you need lds/sts which take more cycles. the solution is to use the virtual port. you can map a port to a virtual port (i think there is a sample) and then you can still use cbi/sbi.
but even without virtual port i would not expect it to be slow. _________________ Mark |
|
Back to top |
|
|
PeterM
Joined: 09 Jun 2008 Posts: 118
|
Posted: Thu Jul 05, 2012 1:44 am Post subject: |
|
|
Mark
Interesting, below is the code I am using.
I bought one of those Olimex boards so this is my first time experience
so excuse the beginner questions.
I also thought the "Config Sysclock" was only for Time/Date clock routines
but it affects the overall microcontroller speed if not set the same Mhz as in
"Config OSC" and "$Crystal settings".
Code: |
$ASM
;----------------------
TDelay:
dec r23
brne Wtic
ret
Com2Out:
;----------------------
ldi r24, 170
;----------------------
ldi r25,8
S_Begin1:
lsR r24
brcc S_Low1
sbi PORTK,7
rjmp S_High1
S_Low1:
cbi PORTK,7
Nop
Nop
Nop
S_High1:
LDI r23,1
RCALL TDelay
dec r25
brne S_Begin1
RET
$END ASM
|
_________________ Peter |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Jul 05, 2012 8:38 am Post subject: |
|
|
yes, config sysclock sets the processor clock. But one could use $crystal and a different value. Or switch while running the program.
In normal conditions, the $crystal should match the system clock.
Have a look at config vport in the help. it will make it clear i think. _________________ Mark |
|
Back to top |
|
|
PeterM
Joined: 09 Jun 2008 Posts: 118
|
Posted: Thu Jul 05, 2012 11:18 am Post subject: False Alarm |
|
|
Mark
I tried various settings and found no change to output speed (vport etc.)
I must admit Bascom has has made things very easy to interface to the Xmega
reading through the help file.
BUT I found the problem, I was comparing my signal to a Clock Signal (way too fast)
the probe was on the wrong test point!!!.
That's what happens when you have many late nights 3 am in the morning. _________________ Peter |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Jul 05, 2012 12:07 pm Post subject: |
|
|
yes i know about this problem. i always put something away for a day in such a case, and then take a new fresh look. sometimes the problem is surprising simple
_________________ Mark |
|
Back to top |
|
|
|