CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Slave i2c over 128 byte times ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
smart277



Joined: 18 Apr 2020
Posts: 1

View user's profile Send private message

Slave i2c over 128 byte times ?
PostPosted: Sat Apr 18, 2020 4:55 am     Reply with quote

Hi. Sir,

I'm trying to processing slave i2c over 128 Byte times?

but, i have no idea..

Is the read/write limit to 0x7F(127) times at once?

How can i solve this?
Quote:


#INT_SSP
void ssp_interupt (){
BYTE incoming, state;

state = i2c_isr_state();
if(state < 0x80) //Master is sending data
{
incoming = i2c_read();

if(state == 1) //First received byte is address
Address = incoming;
if(state == 2){ //Second received byte is adddress
Address = (incoming << 8 |Address);
WriteBufferCnt = 0;

if(state >= 3){

WriteBuffer[WriteBufferCnt] = incoming; // For Test
WriteBufferCnt++;

if(WriteBufferCnt > 90)
WriteBufferCnt = 90;

}
}
if(state >= 0x80) //Master is requesting data
i2c_write(buffer_0x94_0x0000_0x0084[Address]); // <===== 0x0080, 0x0081, 0x0082, 0x0083 can not access (wrong data)
Address++;
}
BYTE incoming, state;

state = i2c_isr_state();

if(state < 0x80) //Master is sending data
{

}
else{


}


}
temtronic



Joined: 01 Jul 2010
Posts: 9244
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Apr 18, 2020 4:57 am     Reply with quote

Please post what I2C device you're trying to use as the 'slave'.
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Sat Apr 18, 2020 7:29 am     Reply with quote

I think he is trying to be the slave.

Yes, the I2C_ISR_State function only supports write or read counts up
to 127/128 bytes. This is common to a lot of hardware I2C devices as well.
For example EEPROM devices commonly support 8, 16, 32, 64 or 128 bytes
maximum in a single transfer.
The solution is the same as for these chips. Send 64bytes, then launch
a new transaction.
jeremiah



Joined: 20 Jul 2010
Posts: 1355

View user's profile Send private message

PostPosted: Sat Apr 18, 2020 8:15 am     Reply with quote

Another option I have done in the past was make my own state function. I took a look at my chip's assembly code for the CCS state function and it essentially looked at a couple of bits in one of the I2C registers. Based on the value of those two bits, it returned specific value. I just duplicated that code but expanded the state values from 8bits to 16bits to give me more data.

It takes some work, but if you don't want to break up your packets (which has its own logistics problems sometimes), that is an alternative. If you go that route, you'll need to look at the assembly for your chip, try to understand what it is doing and create your own version of that logic, using a larger state type than the original.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
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


Powered by phpBB © 2001, 2005 phpBB Group