P. Expert I2C Bean problem.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

P. Expert I2C Bean problem.

Jump to solution
2,400 Views
ecotecsa
Contributor II

Hello everybody,

 

JM60 I2C module connected to TMP100 I2C Temperature sensor.

Problem is that process   EI2C1_RecvBlock(data,2,Rcv);     disable my Port A when is  excecuted.

All other comunication process with TMP100 temperature sensor work perfectly.

Part of code:

 

int  Read_Temp (){
  
   int Tph,Tpl;
   error=EI2C1_SelectSlave(0x48);           
   Pointer=0x00;
   error=EI2C1_SendChar(Pointer);            
   error=EI2C1_RecvBlock(data,2,Rcv);     // Here disable Port A (in *Rcv0=:smileywink:                                                  

   Temph=*data;                             
   Templ=*(data+1);                             
   Tph=(int)Temph;
   Tpl=(int)Templ;
   Tph <<= 4;
   Tpl >>= 4;
   Temp=Tph|Tpl;
  
   PTADD=0x18;                              //Enable PTAD because
   PTAD=0x18;                               // RecvBlock disable  this
   return (Temp);
 }

 

Thank you very much for suggestions.

Best Regards

Eduardo.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
955 Views
ecotecsa
Contributor II

Hi Compilerguru,

 

I was defined:

byte Datos[128];

and

data=&Datos[0];  // in main

Then

int leo_Temp { ...}

 

Thank you

Eduardo

View solution in original post

0 Kudos
Reply
5 Replies
955 Views
CompilerGuru
NXP Employee
NXP Employee

What is data? Is it a NULL pointer?

The reason I ask is that PTAD/PTADD happen to be at address 0/1, so could it be that you are using the port registers as data buffer?

0 Kudos
Reply
956 Views
ecotecsa
Contributor II

Hi Compilerguru,

 

I was defined:

byte Datos[128];

and

data=&Datos[0];  // in main

Then

int leo_Temp { ...}

 

Thank you

Eduardo

0 Kudos
Reply
955 Views
DesignFeats
Contributor I
HI, I have attached a simple ...(or so I thought) I2C read of a temp semsor I have had no luck getting it going. 12Mhz Xtal 51Jm64 Coldfire v1 P Expert Bean I2C framework. Wont send byte after setting slave address? Any ideas? David
0 Kudos
Reply
955 Views
DesignFeats
Contributor I
Found error.. Microchip MCP9805 pinout is different to MCP9808, used MCP9805 for MCP9808 as it is missing in Microchip Altium Library Mistake - Altium Microchip Library has MCP9805 but not MCP9808, assumed that as chip is made in same package, same family and has same interface and pin labels...Missed pin swap on SCL/SDA as Altium Schematic in Microchip library has pins jumbled in logical fashion rather than physical position Arrgh..
0 Kudos
Reply