Saturday, November 5, 2011

24LC512 with the PSoC3 - PageWrite Problems

So I had this I2C EEPROM from Microchip,the 24LC512 lying around(must've sampled it ages ago,don't recall..) and decided to give it a go with the PSoC3.

I'll be posting all the code with schematics once I'm done.(on my new github repo :) )

I got the ByteRead and ByteWrite working fine in an hour after some tweaking(this is my first encounter with I2C),but the PageWrite stuff is not going that smoothly.I mean,I've defined the function such,

uint8 EEPROM_WritePage(uint8 SlaveAddress, int wAddress, uint8 *wData);

So,the wData is basically an Array that will be passed to the function,who'll use it further.And heres how I've called it.

status=EEPROM_WritePage(SLAVE_ADDR,0x00,TxData);

Where SLAVE_ADDR has been given a value already,(0x50) and TxData is defined as uint8 TxData[128] and then populated with a for loop,for writing purposes.Ideally,the function should take in TxData as a pointer to TxData[0] and then the code uses that further.But in my case,the function refuses to see the data.
Heres a screenshot of what I mean:

This is a view of the Locals window,while stepping through.As you can see,the other variables(SlaveAddress and wAddress) have taken on the values,but wData is still some nonsense.

I dont know whats going off.

I think I might be stepping into some interesting territory here..

Update: Could it be because of the array being stored in External RAM(XDATA) ? I'll need to explore that.
Update(next morning): Stupid Mistake on my end.Hmm,I guess that is how we learn.
                                      Implemented All Read and Write Functions,will put up the code soon.

No comments:

Post a Comment