I2C component faulty

For general Flowcode discussion that does not belong in the other sections.
Post Reply
jollybv
Posts: 141
http://meble-kuchenne.info.pl
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

I2C component faulty

Post by jollybv »

Hi Guys I'm having a problem with the I2C component in V7 as it wont let me select the SDA and SCL pins when i click on the dropdown menus it is blank how can i sort this out? as i deleted flowcode downloaded it again reloaded it still the same thing is happening
I2C.jpg
I2C.jpg (37.31 KiB) Viewed 412 times

BenR
Matrix Staff
Posts: 1978
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 519 times
Been thanked: 707 times

Re: I2C component faulty

Post by BenR »

Hello,

What chip are you using? Can you attached your project file?

I've just tried the 16F18877 in v7 and it appears to be working correctly there.

Would using a software channel or upgrading to v10 be an option?

jollybv
Posts: 141
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Hi Ben
I'm using the 18F47K40 I have V9 as well but the program wont compile in V9 so i have to use V7 as i really don't have the time to reprogram the whole project. V10 I would like to get but to expensive for me at the moment as i live in South Africa its like 20 to 1 exchange rate.

I have fired up my old PC and tried programming there on both machines I'm running V7.3.0.5 What I have found on the old machine I can set channel 1 and 2 of the I2C. On the 18F47K40 chip I'm using its connected to clock C3, Data C4, but if i set it to channel 1 or 2 it just hangs on the first read memory. If i set it to software on the first read it works but when you try to write a bite to memory using the SendByte Transaction it goes through all the motions but dos not store. If I write a number of bytes using the TransmitBite method it writes to memory without a problem.

I hope I'm making sense

My board has been working for a few years without problems so really not sure what could of caused this as the program has not been changed in a while
E-P_U6_V-6-0-1_WasWorking_01-12-24_For-A7682E.fcfx
(904.41 KiB) Downloaded 14 times

jollybv
Posts: 141
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Another thing is if i try to program the chip from my new PC the compiler hangs. I thought that the compiler was corrupt so i copied from old machine into new machine still no luck. I Have done a windows 11 repair as i thought something might be corrupt with windows then i removed V7 and reloaded it still no luck not sure where to go from here now
Compiler message.jpg
Compiler message.jpg (38.56 KiB) Viewed 316 times

jollybv
Posts: 141
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Hi guys

I'm not sure what i did but turned the PC on this morning and i was able to compile to the chip everything seems to be working the only thing that isn't is the I2C channel but it is working with software.
One thing I cant understand is the addressing to talk to the I2C memory if A1, A2, A3 are all pulled to ground then the ControlByte should be 0xA0 for write 0xA1 for read but if i do a Sendbyte Transaction or ReceiveByte Transaction I need to use 0x50 or it dose not work. Using the TransmitByte and ReceiveByte I have to use 0xA0 and 0xA1 which is verry confusing but it is working

LeighM
Valued Contributor
Posts: 502
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 87 times
Been thanked: 268 times

Re: I2C component faulty

Post by LeighM »

Sounds like the address of the device is 0x50.
The protocol has this 7 bit address in the highest 7 bits of the first byte, with the read/write flag in bit 0.
Hence the address appears shifted left one bit.

jollybv
Posts: 141
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Hi Leigh

But it is strange how can the device have 2 addresses 0xA0 for when i do a TransmitByte transaction but 0x50 for SendByte Transaction dose not make sense I've even asked AI and it says that the 24LC256 address if all address lines are to ground is 0xA0 for read and 0xA1 for write so I'm not sure how this is working.

LeighM
Valued Contributor
Posts: 502
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 87 times
Been thanked: 268 times

Re: I2C component faulty

Post by LeighM »

Have a look at a datasheet for the device and the protocol diagrams should help.
Ps. The transaction API works with a predefined device address, the transmit byte is a low level raw byte send.

Post Reply