Pages: [1]   Go Down
Author Topic: I2C - Problem with onRequest, onReceive  (Read 298 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I've problem with IDE 1.5.2 and Arduinu DUE.

My program size: 304,492 bytes
Free RAM: cca 70kB [ not 100% ] - used some code to get this number

Problems started after I've added Wire1 as I2C Slave and using :
- onRequest
- onReceive

The same problem with Wire and Wire1.
  
Since that program freezes at the same location - not in I2C callback [ I think ] but while drawing to TFT display.

I'm thinking about some Stack issue but can't [ don't know how ] investigate it more.

  Wire1.begin(NET_MODULE_WIRE_ADDRESS);
  Wire1.onRequest(onRequestHandler);
  Wire1.onReceive(onReceiveHandler);


void  onRequestHandler(void)
{
  byte val ;
  switch (cmd_received)
  {
    //je queue prazdna ?
    case CMD_QUEUE_EMPTY:
    
      Wire1.write(RQX_HEADER);
      Wire1.write(queue[0].empty);
      
    break;

}}

//receive command from network arduino UNO
void onReceiveHandler(int howMany )
{
 
  if(Wire1.available())
  {
    cmd_received = Wire1.read();
  }
 
  
}
« Last Edit: July 15, 2013, 08:07:31 am by mzahor » Logged

Pages: [1]   Go Up
Jump to: