• AVR Freaks

AnsweredHot!PIC24F16KA102- I2C operation during Deep sleep mode

Author
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
2019/11/19 07:49:22 (permalink)
0

PIC24F16KA102- I2C operation during Deep sleep mode

Hi,
I was going through the PIC24F series nano power Technology based uC.
I've few questions on I2C operation in deep sleep and sleep mode and would like to confirm few
As per the data sheet, During deep sleep mode, few(configurable) peripherals can be active. Does this include I2C,SPI?
Since in the below documents, It says when in the middle of communication if device sleep/deep sleep mode module behavior will also be undefined.
http://ww1.microchip.com/downloads/en/devicedoc/70000195f.pdf.
In my application, a sensor needs to be active all the time (I2C interface) with battery operated. Been looking for a nanoWatt XLP Technology based controller(sleep mode most of the time, with peripheral accessible to sensor).
 
Thank you. 
#1
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/19 16:15:21 (permalink)
0
If the device is an I2C slave (not master), then it requires code running on your PIC to do each I2C transfer, which is not going to happen while it is sleeping.
What do you want the device to do when the PIC is sleeping? Can't you just wake the PIC up at regular intervals, do the transfer, then go straight back to sleep?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/19 20:55:12 (permalink)
0
As said a sensor that needs to be active all the time and any changes should wake up the controller and send the Packets and go back to sleep. So when in PIC Low power modes, It has to read the data from the sensor(slave) over I2C. 
But the data-sheet mention any current consumption, during Doze-mode.
In the case of sleep and Deep sleep, I2C is accessible?
 
#3
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/19 21:00:01 (permalink) ☼ Best Answerby Lakshminarayana 2019/11/19 23:37:48
0
Have you ever written any I2C code on a PIC?
I guess not, because you would then realise that the PIC has to be actively involved in each step of the transfer. It's simply not going to happen if the PIC is sleeping.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
NKurzman
A Guy on the Net
  • Total Posts : 18060
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/19 21:18:40 (permalink)
0
"A Sensor"  That makes every thing clear???
Is the PIC24 the Master or Slave? 
If it is a Slave them the I2C could Wake it.
If it is the Master then the Only way to wake it would be if the "Sensor" has an interrupt out Pin.
#5
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/19 21:23:25 (permalink)
5 (1)
NKurzman
...
Is the PIC24 the Master or Slave? 

As I asked in post#2.
The OP has failed to make this crucial point clear.
 
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#6
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11432
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/19 23:08:16 (permalink)
0
I'm guessing the sensor is an I2C slave to the PIC.  I think the OP doesn't understand what "sleep" means.  I suspect she thinks that the I2C peripheral can autonomously poll the sensor while the PIC is asleep (it can't).  You need a sensor that can run autonomously and that has an interrupt that can wake the PIC up with something happens, then the PIC can do the I2C transaction.  This is common in e.g., accelerometers.
#7
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/19 23:40:15 (permalink)
0
No,
I have not worked on PIC yet. 
can you please answer this: But in the data-sheet I don't see any mentioning of current consumption, during Doze-mode.
PIC is master and Sensor is Slave.
Yes I agree with you almost all of accelerometer have interrupt pin but what I'm worried is their FIFO is very less(like can store only 32samples). 
In my application would like to generate interrupt when there's movement.
post edited by Lakshminarayana - 2019/11/20 00:15:07
#8
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11432
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 01:16:23 (permalink)
0
Why are you worried about the FIFO depth?  You'll get an interrupt before any data is lost, and then you can read the FIFO.
 
Why do you need doze mode?
#9
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 02:54:21 (permalink)
0
Thank you.
so will get interrupt for every 32 samples?
I do not want that to be in my case. In case of change in movement, then only it should generate interrupt. So that it'll help in extending the battery life.
Doze mode: Since in the data sheet, It's mentioned that few of peripherals can be active in doze mode.so.
#10
jtemples
عُضْوٌ جَدِيد
  • Total Posts : 11432
  • Reward points : 0
  • Joined: 2004/02/13 12:31:19
  • Location: Southern California
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 10:22:08 (permalink)
5 (1)
will get interrupt for every 32 samples?

 
How could anyone know the answer to that?  You haven't told us what your sensor is.
#11
NKurzman
A Guy on the Net
  • Total Posts : 18060
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 10:57:34 (permalink)
0
Your Unknown Sensor will work the Way IT'S Data sheet says.  I assume it is a serect since you refuse to answer any questions about it.
"I have not worked on PIC yet"  A PIC or Any Micro controller?
I would make sure it works before you try making it work with Sleep.
#12
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 17:42:14 (permalink)
0
Sorry.
LIS2DH12TR accelerometer sensor.
#13
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 17:46:13 (permalink)
0
https://www.st.com/en/mems-and-sensors/lis2dh12.html
https://www.st.com/resource/en/datasheet/lis2dh12.pdf
 
That device has intelligent interrupt capabilities. Have you connected the interrupt pin(s) to your PIC?
 
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#14
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 18:06:03 (permalink)
0
No, 
But in the FIFO section it says it can generate an interrupt if FIFO filled up.
#15
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 18:51:01 (permalink)
5 (1)
How is it going to generate an interrupt if you have not connected the interrupt pins?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#16
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 19:36:37 (permalink)
0
I'll be but before that, I need to know when it'll generate interrupt only when FIFO filled up or any movement detection?
#17
NKurzman
A Guy on the Net
  • Total Posts : 18060
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 19:55:00 (permalink)
0
Section 5.1 FIFO
This buffer can work according to the following different modes: Bypass mode, FIFO mode, Stream mode and Stream-to-FIFO mode. Each mode is selected by the FM [1:0] bits in FIFO_CTRL_REG (2Eh). Programmable FIFO watermark level, FIFO empty or FIFO overrun events can be enabled to generate dedicated interrupts on the INT1 pin (configuration through CTRL_REG3 (22h)).
 
 The Answer is yes depending how it is configured.
 
Movement detected Interrupt is a different section.
#18
ric
Super Member
  • Total Posts : 24638
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 19:55:24 (permalink)
0
Whatever the datasheet says it will do.
That's your job to decide when you need to be interrupted.
Do you need to receive ALL the data (which means you're going to be woken up at a fairly rapid rate to keep transferring data), or use the sensor's intelligent features to wake you up when a movement threshold is exceeded.
 
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#19
Lakshminarayana
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/09/24 03:49:54
  • Location: 0
  • Status: offline
Re: PIC24F16KA102- I2C operation during Deep sleep mode 2019/11/20 21:53:32 (permalink)
0
In my application, latter will be the case i.e. "use the sensor's intelligent features to wake you up when a movement threshold is exceeded."
#20
Jump to:
© 2019 APG vNext Commercial Version 4.5