Any Updated PDL version for MB9AF314L. PDL2.1 have mfs->I2C problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AnBa_4529756
Level 2
Level 2
5 replies posted First like received First reply posted

Hi,

Any Updated PDL version for MB9AF314L. PDL2.1 have mfs->I2C problem. When I tried to call the read function, the program goes in an infinite loop.

I want to interface AT24C512 I2C EEPROM with MB9AF314L

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

First of all, please note that as I don't have an evb board with the device nor EEPROM, I can not test the project by myself.

So I'm trying to answer only from the source code.

Since SDA and SCL are functioning, your setting of PINs and I2C component number must be correct.

And I assume that you specified those in "at24cxx_config.h", right?

By the way, reading at24cxx_config.h, I noticed something funny.

In the beginning of this header it defines devices as

=======================

/**

******************************************************************************

** EEPROM Device List

******************************************************************************/

#define PDL_EEPROM_AT24C01           0

#define PDL_EEPROM_AT24C02           1

#define PDL_EEPROM_AT24C04           2

#define PDL_EEPROM_AT24C08           3

#define PDL_EEPROM_AT24C16           4

#define PDL_EEPROM_AT24C32           5

#define PDL_EEPROM_AT24C64           6

=======================

But then it defines

=======================

#define PDL_EEPROM_DEVICE PDL_AT24C02

=======================

I wonder where this PDL_AT24C02 came from?

May be you (or we?) need to modified or add the first block of this header something like

=======================

/**

******************************************************************************

** EEPROM Device List

******************************************************************************/

#define PDL_AT24C01           0

#define PDL_AT24C02           1

#define PDL_AT24C04           2

#define PDL_AT24C08           3

#define PDL_AT24C16           4

#define PDL_AT24C32           5

#define PDL_AT24C64           6

=======================

moto

View solution in original post

10 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

If you are using MDK KEIL for the compiler,

you may be having same problem I had before.

I2C read hangs with MDK (PDL 2.1.0, PSoC Creator 4.0)

If it is not the case, I'm sorry.

moto

0 Likes

Thanks, Motoo,

My issue is the same as you mentioned, the only difference is in microcontroller device.

Please give me a suggestion, how I can move forward.

I have tried the EEPROM example which is provided in the PDL setup.

but there is no provision for AT24C512 I2C EEPROM.

and I also found the issue, while selecting the EEPROM IC in user setting,

#define PDL_EEPROM_DEVICE     PDL_AT24C02

but when I select PDL_AT24C64 instead of PDL_AT24C02, the program will compile but when I observe the I2C waveform on DSO the address length is the only 1byte, when I start debugging then I found that the value of AT24CXX_ADDR_LENGTH is not updated as per the selected device. what is the reason for that.???

Thanks for your support.

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I assume that you are talking about the 2.1.0 > utilties > eeprom.

I ran grep PDL_AT24C * there, and I got

=======================

$ grep PDL_AT24C *

at24cxx_config.h:#define PDL_EEPROM_DEVICE     PDL_AT24C02

i2c_at24cxx.h:#if (PDL_EEPROM_DEVICE == PDL_AT24C01) || \

i2c_at24cxx.h:    (PDL_EEPROM_DEVICE == PDL_AT24C02)

i2c_at24cxx.h:#elif (PDL_EEPROM_DEVICE == PDL_AT24C04) || \

i2c_at24cxx.h:      (PDL_EEPROM_DEVICE == PDL_AT24C08) || \

i2c_at24cxx.h:      (PDL_EEPROM_DEVICE == PDL_AT24C16)

i2c_at24cxx.h:#elif (PDL_EEPROM_DEVICE == PDL_AT24C32) || \

i2c_at24cxx.h:      (PDL_EEPROM_DEVICE == PDL_AT24C64)

i2c_at24cxx.h:#if (PDL_EEPROM_DEVICE == PDL_AT24C01) || \

i2c_at24cxx.h:    (PDL_EEPROM_DEVICE == PDL_AT24C02) || \

i2c_at24cxx.h:    (PDL_EEPROM_DEVICE == PDL_AT24C04) || \

i2c_at24cxx.h:    (PDL_EEPROM_DEVICE == PDL_AT24C08) || \

i2c_at24cxx.h:    (PDL_EEPROM_DEVICE == PDL_AT24C16)

=======================

So I think that supported devices are

=======================

AT24C01

AT24C02

AT24C04

AT24C08

AT24C16

AT24C32

=======================

And defined functions were

=======================

en_result_t At24cxx_Init(void);

en_result_t At24cxx_ByteWrite(uint8_t u8DevAddr, uint16_t u16Addr, uint8_t u8Data);

en_result_t At24cxx_PageWrite(uint8_t u8DevAddr, uint16_t u16PageAddr, uint8_t* pu8Data, uint8_t u8Size);

en_result_t At24cxx_CurrentAddrRead(uint8_t u8DevAddr, uint8_t* pu8CurData);

en_result_t At24cxx_RandomRead(uint8_t u8DevAddr, uint16_t u16Addr, uint8_t* pu8Data);

en_result_t At24cxx_SequentialRead(uint8_t u8DevAddr, uint8_t* pu8Data, uint8_t u8Size);

void At24cxx_Delayms(uint32_t u32Cnt);

=======================

In the i2c_at24cxx.h, AT24CXX_ADDR_LENGTH is defined 1 or 2.

So if you expect/need longer address for your AT24C512,

probably you need to modify the functions with u16Adder and/or u16PageAddr to support your device.

moto

Thanks for your continuous support.

Yes, I am talking about 2.1.0 > utilities > EEPROM.

but when I change the device from AT24C01 to AT24C32 in at24cxx_config.h

as per the flow of libraries the value of AT24CXX_ADDR_LENGTH this should be 2 after selecting the device

but I found the value of AT24CXX_ADDR_LENGTH will not update, I also observe the waveforms on DSO

What should be the reason, or I have done any mistake while defining the device

for your reference, I am also sharing the DSO waveform for the below line of code,

  At24cxx_ByteWrite(u8DevAddr, 0x0055u, 0x01);

F0003TEK.BMP

where,

selected device is

/**

******************************************************************************

** EEPROM device selection [User setting]

******************************************************************************/

#define PDL_EEPROM_DEVICE     PDL_AT24C64

/** I2C IO function initialization */      

#define InitI2cIo(void)  {SetPinFunc_SOT2_2();SetPinFunc_SCK2_2();}

/** I2C channel used for AT24C02   */

#define EE_I2C_CH        &I2C2 

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

First of all, please note that as I don't have an evb board with the device nor EEPROM, I can not test the project by myself.

So I'm trying to answer only from the source code.

Since SDA and SCL are functioning, your setting of PINs and I2C component number must be correct.

And I assume that you specified those in "at24cxx_config.h", right?

By the way, reading at24cxx_config.h, I noticed something funny.

In the beginning of this header it defines devices as

=======================

/**

******************************************************************************

** EEPROM Device List

******************************************************************************/

#define PDL_EEPROM_AT24C01           0

#define PDL_EEPROM_AT24C02           1

#define PDL_EEPROM_AT24C04           2

#define PDL_EEPROM_AT24C08           3

#define PDL_EEPROM_AT24C16           4

#define PDL_EEPROM_AT24C32           5

#define PDL_EEPROM_AT24C64           6

=======================

But then it defines

=======================

#define PDL_EEPROM_DEVICE PDL_AT24C02

=======================

I wonder where this PDL_AT24C02 came from?

May be you (or we?) need to modified or add the first block of this header something like

=======================

/**

******************************************************************************

** EEPROM Device List

******************************************************************************/

#define PDL_AT24C01           0

#define PDL_AT24C02           1

#define PDL_AT24C04           2

#define PDL_AT24C08           3

#define PDL_AT24C16           4

#define PDL_AT24C32           5

#define PDL_AT24C64           6

=======================

moto

Thanks for suggesion,

As suggested I have update the at24cxx_config.h file,

and observe the waveform on DSO, now the waveform get change for below line of code

At24cxx_ByteWrite(u8DevAddr, 0x0055u, 0x01);

F0006TEK.BMP

where,

selected device is

/**

******************************************************************************

** EEPROM device selection [User setting]

******************************************************************************/

#define PDL_EEPROM_DEVICE     PDL_AT24C64

/** I2C IO function initialization */     

#define InitI2cIo(void)  {SetPinFunc_SOT2_2();SetPinFunc_SCK2_2();}

/** I2C channel used for AT24C02   */

#define EE_I2C_CH        &I2C2

Also, i would like to ask the meaning of,

#define PDL_DSTC_ENABLE_MFS2_RX                 PDL_OFF

#define PDL_DSTC_ENABLE_MFS2_TX                 PDL_OFF

what is DSTC ??

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

> what is DSTC ??

DSTC stands for Descriptor System Data Transfer Controller.

The driver resides,

2.1.0 > drivers > dstc

And please read the description in dstc.h.

By the way, in this community usually one question and one answer is the formula/protocol.

And I hope that I have provided the (or an) answer to your first question along with the second and the third one.

Would you please mark my answer as a Correct Answer if it is so and close this discussion

and post a new question as a new discussion if you have more question(s)

so that others can find the question-answer pair easily?

moto

Hi,

by doing changes in header file, I got proper waveform as per address lenght while wrinting, but still I not getting output. while reading EEPROM the program hang.

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

HI,

> by doing changes in header file, I got proper waveform as per address lenght while wrinting,

This is good news.

> but still I not getting output. while reading EEPROM the program hang.

But this is bad news.

If the waveform (I2C data/clock) for requesting data is correct,

may be you need put some delay after sending read request and before start reading.

But if it does not work,  I don't have any good idea.

moto

0 Likes