Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

FM24C64 with Xmega

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
mansur

Bascom Member



Joined: 21 Feb 2013
Posts: 37
Location: Jakarta

indonesia.gif
PostPosted: Thu Oct 04, 2018 8:00 am    Post subject: FM24C64 with Xmega Reply with quote

Dear all,
can you advice me about external eeprom in xmega.
I'm already make epprom circuit FM24C65 with TWIC in xmega256B3U.

the address configuration is(000) A2,A1,A0.

and the result for serial debugging is:

The reading result of address equal 114 (wrong data).
the bascom source code:
Code:

$regfile="xm256A3BUdef.dat"
$crystal = 32000000                                         ' 32MHz
$hwstack = 128
$swstack = 128
$framesize = 128

Config BASE = 0                                             ' arrays start at 0

'first enable the osc of your choice
Config Osc = Enabled , 32mhzosc = Enabled
'configure the systemclock
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
'for debug we send some data to the UART
Config Com3 = 115200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
open "COM3:" for binary as #2
Config Twic = 100000                                       ' CONFIG TWI will ENABLE the TWI master interface
const cfram_channel = 1                                    ' this constant is required by the fm24c64_256-xmega lib
                                                          ' set it to 1 for TWIC , 2 for TWID , 4 for TWIE and 8 for TWIF
'Open "twic" For Binary As #1                               ' when not using default twic, you must use a channel

const _twi_stop_1 = 1                                       ' just test i2cstop option, see help

Dim Twi_start As Byte                                       ' always required for xmega i2c
I2Cinit' #1

$eepromsize = &H8192                                         ' set it to the size of your EEPROM
$lib "fm24c64_256-xmega.lib"                               ' include lib


dim ee(100) as eram byte                                   ' dim an EEPROM array
Dim B , adres As byte

print #2, "Writing EEEPROM"
for adres = 0 to 10
   print#2, adres ; ",";
   ee(adres) = adres
   'waitms 20                                               ' ONLY FOR NORMAL EEPROM , REMOVE FOR RAMTRON
next
print

print#2, "read EEEPROM"

for adres = 0 to 10
   b = ee(adres)
   print#2,  adres;"-";b
next

end

 


(BASCOM-AVR version : 2.0.8.1 , Latest : 2.0.8.1 )

_________________
Mansur. H
Automation & Instrument Engineer
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5091
Location: Holland

blank.gif
PostPosted: Thu Oct 04, 2018 8:18 pm    Post subject: Reply with quote

do scl and sda have pull up regs?
_________________
Mark
Back to top
View user's profile Visit poster's website
mansur

Bascom Member



Joined: 21 Feb 2013
Posts: 37
Location: Jakarta

indonesia.gif
PostPosted: Fri Oct 05, 2018 7:39 am    Post subject: Reply with quote

Hi Albert Mark,
We use the hardware pullup.

_________________
Mansur. H
Automation & Instrument Engineer


Last edited by mansur on Fri Oct 05, 2018 9:11 am; edited 2 times in total
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5091
Location: Holland

blank.gif
PostPosted: Fri Oct 05, 2018 9:03 am    Post subject: Reply with quote

and you are sure you use a ramtron FM chip? It will not work on a plain eeprom.

i tested this on both twic and twie.

otherwise try to address the chip first with normal i2c code. and'/or use the i2cbus scanner sample to validate the address.

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

Bascom Member



Joined: 21 Feb 2013
Posts: 37
Location: Jakarta

indonesia.gif
PostPosted: Fri Oct 05, 2018 9:20 am    Post subject: Reply with quote

Mark,

The manufacture is Cypress Semiconductor, the type is F Ram chip.
I bought from mouser.com
https://www.mouser.co.id/ProductDetail/877-FM24CL64B-G
the datasheet as attached, and i'm already compare with ramptron datasheet and the result is similiar chip.

Ok, we will try with normal I2C mode like general i2c eeprom.

_________________
Mansur. H
Automation & Instrument Engineer
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5091
Location: Holland

blank.gif
PostPosted: Fri Oct 05, 2018 9:39 am    Post subject: Reply with quote

yes that is the right chip.

just make sure WP is connected to ground !

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

Bascom Member



Joined: 21 Feb 2013
Posts: 37
Location: Jakarta

indonesia.gif
PostPosted: Sat Oct 06, 2018 11:06 pm    Post subject: Solved Reply with quote

[quote=\"albertsm\"]yes that is the right chip.

just make sure WP is connected to ground ![/quote]

Thanks Marks,
the problem has been solved by reflow the smd chip.

_________________
Mansur. H
Automation & Instrument Engineer
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
Page 1 of 1

 
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