Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

atxmega128a3u problem with TWID and TWIF
Goto page 1, 2  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Wed Jun 16, 2021 4:30 pm    Post subject: atxmega128a3u problem with TWID and TWIF Reply with quote

Hello
I am using the i2c scan program to find the address for modules. TWIC and TWIE working fine but TWID and TWIF crash the scanner. Does anyone know or had a similar problem with TWID and TWIF ?

Code:
$REGFILE = "xm128a3Udef.dat"
$CRYSTAL = 60000000 '60MHz
$HWSTACK = 100
$SWSTACK = 100
$FRAMESIZE = 100
$LIB "xmega.lib"
CONFIG OSC = Enabled , Pllosc = Enabled , Pllmul =  30
CONFIG SYSCLOCK = pll
CONFIG PRIORITY = Static , Vector = Application , lo = Enabled
ENABLE INTERRUPTS
'----------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------              TWI             ---------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------
Dim Twi_start As Byte
'Config Scl = Porte.1
'Config Sda = Porte.0
Config Twie = 100000
Open "twie" For Binary As #4
I2cinit #4
'----------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------            ILI9341           ---------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------
   CONFIG Vport0 = f 'wybierz sobie port
   CONFIG Graphlcd = Color , Cs1 = Port0.7 , Rst = Port0.6 , A0 = Port0.5 , Si = Port0.4 , Sclk = Port0.3
   CONST Portrait = 1
   CONST Rotate_180 = 0
   DIM Offset256 As Byte
   $LIB "glcd-ILI9341_2R8_240x320.lib"
   INITLCD
   CLS
   SETFONT Color8x8
   CONST Black = &B0000_0000
   CONST Red = &B1110_0000
   CONST Green = &B0001_1100
   CONST Blue = &B0000_0011
   CONST Magenta = &B1110_0011
   CONST Yellow = &B1111_1100
   CONST Cyan = &B0001_1111
   CONST White = &B1111_1111
   CONST Orange = &B1111_0100
   CONST Brightgreen = &B0011_1110
   CONST Brightblue = &B0001_1111
   CONST Darkred = &B1100_0000
   CONST Darkgreen = &B0001_0100
   CONST Darkblue = &B0000_0010
   OffSET256 = 1
   BOXFILL(0 , 0) -(64 , 240) , Black
   OFFSET256 = 0
   BOXFILL (0 , 0) -(255 , 240) , Black
'----------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------         variable          ------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------
   dim B As Byte
'----------------------------------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------------
DO

   For B = 0 To 254 Step 2
   I2cstart #4
   I2cwbyte B , #4
   If Err = 0 Then
   Lcdat 0  , 0 ,"Slave at : " ; b , White, Black
   Lcdat 8  , 0 ,"Slave at : " ; Hex(b) , White, Black
   Lcdat 16 , 0 ,"Slave at : " ; Bin(b), White, Black
   End If
   I2cstop #4
   Next
   Lcdat 24 , 0 ,"End Scan", White, Black

lOOP
END
'----------------------------------------------------------------------------------------------------------------------------
   $INCLUDE "color8x8.font"
'----------------------------------------------------------------------------------------------------------------------------


(BASCOM-AVR version : 2.0.8.3 )
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Wed Jun 16, 2021 6:08 pm    Post subject: Re: atxmega128a3u problem with TWID and TWIF Reply with quote

cyklop1977 wrote:
Code:
$CRYSTAL = 60000000 '60MHz

Not every wish meets reality.
Back to top
View user's profile
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Wed Jun 16, 2021 6:42 pm    Post subject: Reply with quote

It is not problem 60MHz for xm128a3u . I use the speed with sd card,lcd,timers,uarts,external memory etc ....even with TWIC and TWIE (it works good) but I dont know why TWID and TWIF nothing reacts
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Wed Jun 16, 2021 7:01 pm    Post subject: Reply with quote

If you'd know the answers, you would not need to ask.
cyklop1977 wrote:
It is not problem 60MHz for xm128a3u .

If my car's engine can do 5000 rpm, then 10000rpm is no problem.
Moot to discuss errors, which may result from out of spec.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5916
Location: Holland

blank.gif
PostPosted: Wed Jun 16, 2021 8:18 pm    Post subject: Reply with quote

the A3U is a limited version. It has only 2 TWI interfaces.
_________________
Mark
Back to top
View user's profile Visit poster's website
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Wed Jun 16, 2021 8:32 pm    Post subject: Reply with quote

I'm not interested in your imaginary car problems . I wrote that- xmega works without any problems with usart,spi,timers,sdcard,lcd,external SDRAM MT48LC16M,EEPROM etc even TWIC and TWIE run at this xmega speed !! So I wonder why TWID and TWIF are not working ?! you know what, i changed xmega speed for you 32MHz. Do You know what happened ? Same problem, everything works only TWID and TWIF not working. I do not need 4xTWI but I ask out of curiosity why is this happening.logically 4xTWI should work , not just 2XTWI (same program same speed|)...And now write to me (you don't have to) why the same program + reduced speed ( to 32MHz) gives the same effect - 2xTWI work and other two are not ... just don't write me imaginary fairy tales about your car ok
Back to top
View user's profile
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Wed Jun 16, 2021 8:48 pm    Post subject: Reply with quote

Mark , this is the answer I have been waiting for .
My mistake , I read the incorrect pdf 8068A-AVR-02/08 page 45/46. Thanks for the answer .
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5916
Location: Holland

blank.gif
PostPosted: Wed Jun 16, 2021 8:56 pm    Post subject: Reply with quote

Some DAT files were made from preliminary datasheets, other were forked by customers. Some were derived from atmel inc files.
Since almost all were derived from the first 128A1 which has full hardware, some DAT files might have registers that do not exist in hardware.
I have asked our internal support to check the dat files for missing/extra registers in the past to fix this problem.
But once in a while i find mistakes too.

The first starting point should always be the datasheet (an up to date datasheet).
Then check the errata.
I use the datasheet as reference. When it does not work i contact atmel/microchip. they correct the datasheet. Or i change the dat file.

_________________
Mark
Back to top
View user's profile Visit poster's website
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Wed Jun 16, 2021 9:29 pm    Post subject: Reply with quote

Mark , my mistake was because I read superficially :

https://avrhelp.mcselec.com/index.html?config_twi.htm

Open "twic" For Binary As #4 ' or use TWID,TWIE oR TWIF
Config Twic = 100000 'CONFIG TWI will ENABLE the TWI master interface
'you can also use TWIC, TWID, TWIE of TWIF
'!!!!!!!!!!! WITHOUT a channel identifier, TWIC will be used !!!!!!!!!!!!!!

but It is for xmega128a1 ! not for atxmega128a3u , my mistake Smile
thx again

to MWS:

try 60MHz , it is works good with xmega128a3u and for ATxmega128A1U was 50MHz. (my experience ) .
Back to top
View user's profile
JC

Bascom Member



Joined: 15 Dec 2007
Posts: 586
Location: Cleveland, OH

usa.gif
PostPosted: Thu Jun 17, 2021 12:52 am    Post subject: Reply with quote

I've also overclocked several Xmegas.
I've had reliable operations, room temperature, at 48 MHz, for the digital sections of the chip.
(I suspect the ADC, DAC, AC, and EEPROM writes might all have some difficulties at that speed.)

Atomic Zombie, on AVRFreaks, routinely runs them in the 60+ MHz range, typically for his video driver circuits.

One has to know, obviously, that when overclocking the uC the uC's operation isn't guarenteed.
Hence it isn't likely a good option for a commercial product, unless one validates each specific chip in house.
But for hobbyist projects crank up that clock!

JC
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Thu Jun 17, 2021 2:35 am    Post subject: Reply with quote

cyklop1977 wrote:
I'm not interested in your imaginary car problems .

Looks like you did not read the manual of your car, lol.
Quote:
I wrote that- xmega works without any problems with usart,spi,timers,sdcard,lcd,external SDRAM MT48LC16M,EEPROM etc even TWIC and TWIE run at this xmega speed !!

First I don't have to believe that, second overclocking may result in random behavior.
Quote:
Same problem, everything works only TWID and TWIF not working.

That's something I expect from a TO, switch back to in-spec settings and report.
But I expect such info already in the entry post and not only after my request.
Same I expect from a TO with some professionalism to read the car's manual before turning the key.
Seems my expectations ran too high.
Back to top
View user's profile
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Thu Jun 17, 2021 3:54 am    Post subject: Reply with quote

msw ...are you blind ? Mark wrote the answer!...answer 100% correct and solve the problem ... You write to me "I have not read the pdf" , even you haven't read the pdf! ...you write something about overclocking only (it was not problem) ,it had nothing to do with it ..because this xmega doesn't have 4xTWi !! Don't try to be smarter than you think you are ,because you are not ...read about overclocking because I've seen xmega clocked more then i do...I'm not interested of your hurt ego .

I close the topic, the problem is solved.
Back to top
View user's profile
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Thu Jun 17, 2021 4:07 am    Post subject: Reply with quote

JC you are right . Not every one xmega can be overclocked! It depends on many fact . I have several projects that have been working at 60MHz for a year with no problems but the problem here was not overclocking..a simple mistake. I read the wrong pdf .
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Thu Jun 17, 2021 6:57 am    Post subject: Reply with quote

cyklop1977 wrote:
msw ...are you blind ? Mark wrote the answer!...answer 100% correct and solve the problem

I noticed that.
But to be fair, one needs to say there never was a problem, as the controller behaved exactly as expected.
Quote:
even you haven't read the pdf!

I have read it.
Quote:
because this xmega doesn't have 4xTWi !!

I knew.
Quote:
Don't try to be smarter than you think you are ,because you are not

Such words from someone who can't read a manual, while the someone's language is of the aggressive kind.
Quote:
...read about overclocking because I've seen xmega clocked more then i do..

Why should I? I like to have things running reliable and not by circumstance, i.e. depending on production batch, exact controller type a.s.o.
Back to top
View user's profile
cyklop1977

Bascom Member



Joined: 05 Jun 2011
Posts: 11

PostPosted: Thu Jun 17, 2021 7:25 am    Post subject: Reply with quote

Me - "because this xmega doesn't have 4xTWi !!"

You -"I knew. "

OK Smile .... You knew but I didn't write .It is enough for me heheeh .

Topic closed!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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