This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Need help with sd-card mounting time

Hello nordic.

I've been using the PPK2 to measure the current draw of the nRF9160DK. However, spi peripherals are not included in these measurements. I was told that if you power the peripherals from nRF_ref they would be but I'm not getting any/the right amount of voltage from those pins. Only the regular VDD ports seem to work. My board is in 3v3 mode.
As the sd-card draws current, I need to be able to either cut power to it when not needing it or dismount it when not needed and mount it when needed.
In the first case, I would like to set a GPIO to 3v3 output and control the pin from software, I have tried this but can't get the gpio to supply the same as VDD pin.

The other solution is to mount the sd card only when needed, the problem with that is that the procedure can take 100-500 ms which causes me to lose important data. Is there an easy way to multithread or use DMA such that I can save sensor data to RAM while the sd-card is being mounted and then, once mounted, I can write directly to it? This is the last bump in the road and I need to solve this, I should mention I tried using the external NOR flash of the nrf9160dk but it was not fast enough for a dataflow of 32kB/s.

So to sum up:

1. I need to measure spi-consumption on the PPK2 but the nRF_ref does not provide the same voltage as VDD
2. I need to be able to turn on and off power to the sd-card which requires a configurable pin. That is, I need a gpio pin with an output equal to VDD
3. Is there a way to run the mounting procedure in parallel with data recording to RAM such that I don't miss data? How?

Thanks beforehand

Parents
  • Hi

    2. I need to be able to turn on and off power to the sd-card which requires a configurable pin. That is, I need a gpio pin with an output equal to VDD

    Supplying peripherals from the GPIO pins are not recommended. To see the capabilities of the GPIO pins, see GPIO: Electrical specification.

    I would recommend using a transistor for toggling the power to the SD-Card module. For example like this:

    1. I need to measure spi-consumption on the PPK2 but the nRF_ref does not provide the same voltage as VDD

    If your goal is to measure the current of the nRF9160 and the SD Card reader, I think the simplest solution would be to power both directly from the PPK2 in Source Mode, like this:

    Will this solution work for you?

    3. Is there a way to run the mounting procedure in parallel with data recording to RAM such that I don't miss data? How?

    This question is quite different from the other two.
    To keep DevZone tidy, please create a new ticket for this question?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd and thank you! So the transistor would function as an and gate of sorts? I'm new to the electronics part of this, would any transistor do or is there a specific one I need? Do I need anything more than a transistor, breadboard and wire? When using the ppk2 as source, can I jump the vout to both the dk and the sd-card reader without the transistor using breadboard and wires?

    I will create a new ticket for the last question, thank you very much for your help.

  • nWre said:
    So the transistor would function as an and gate of sorts?

    A very simplified way to look at a transistor is a switch controlled by an electronic signal.

    nWre said:
    I'm new to the electronics part of this, would any transistor do or is there a specific one I need?

    There are a lot of good tutorials on transistors on the internet. I recommend you have a look at a couple of those, as the ones made them for sure know more than me about transistors and are likely better at the explaining part.

    nWre said:
    Do I need anything more than a transistor, breadboard and wire?

    Yes, you would need a breadboard and some wire for prototyping (often called "jumper wire" or "dupont wire").

    nWre said:
    When using the ppk2 as source, can I jump the vout to both the dk and the sd-card reader without the transistor using breadboard and wires?

    To connect the PPK2 to two different devices, you will need to branch the cable in two.
    A wire to do is not included in the PPK2 kit. I would say the simplest way to do this is to use a breadboard and dupont wires.
    However, as long as you are able to connect all three devices,it will work.
    There are a lot of ways to do this. Another alternative would for example be to solder together three cables to make a three-way cable.

    If you do not include the transistor, you will not be able to toggle the power of the SD-Card reader, and it will be on all the time.

    Regards,
    Sigurd Hellesvik

  • Hi again Sigurd! And thank you! I've now been able to measure the total current. What I've found is this:

    only the DK: 3,39mA
    The DK and sensors: 4,06mA
    The DK, sensors and SD-card: 6,17mA

    My first question is: when using the ppk2 in source mode, I get 3,39mA but in ampere mode, I get 2,5mA. What should I go on? Is it the voltage regulator that experiences a loss when in source mode?

    and also: do you know of a way to idle the sd-card in a lower current than 2,18mA? I have ordered transistor and will try to "cut" the power once it is mounted but I fear it will not work to cut power to a mounted device.

  • nWre said:
    My first question is: when using the ppk2 in source mode, I get 3,39mA but in ampere mode, I get 2,5mA. What should I go on? Is it the voltage regulator that experiences a loss when in source mode?

    Both modes should measure the same current if you have set up the measurement correctly.
    Source Mode and Ampere Mode should be connected in two different ways. Could you send pictures of how you have connected the PPK2 in the different modes?

    Did you remember to prepare the DK for power measurement? See Measuring current for the nRF9160.

    nWre said:
    and also: do you know of a way to idle the sd-card in a lower current than 2,18mA? I have ordered transistor and will try to "cut" the power once it is mounted but I fear it will not work to cut power to a mounted device.

    Yea, once it is mounted, it will work poorly to just remove the power from it.

    SD Card storage is for long time storage. So my guess is that you will write to it infrequently.
    If this is the case, I suggest that you only turn the SD Card reader on when you need to write to it.
    So Power -> Mount -> Read/Write -> Unmount -> Poweroff.

    To save more power for the nRF, concider also disabling the SPI peripheral when not using it.

    Would this work for your application?

    Regards,
    Sigurd Hellesvik

  • Hi! This is my setup(forgive my paint skills) when using source mode:



    I do have a usb connected to the DK for programming and that would explain the noise. However, can I split the vout from the PPK2 to connect to both nrf_ref on P22 AND supply on P21? If not, would there be a reasonable assumption that the current from ampere mode is the correct one and the added one I get in source mode is due to noise? I should also point out that the ground from PPK2 is connected to the negative terminal on P21.

    Regarding the second part: This would be ideal, however the sd-card mounting procedure takes too much time when it is needed and data is lost. I have created a second ticket for this, thank you very much for your help.

    Edit: When in ampere mode, I have connected it according to the instructions on the PPK2 tutorial video from nordic on youtube.

  • expanded picture for clarity

Reply Children
  • Hi

    You connection diagram looks fine.

    Keep in mind that on the nRF9160DK, there are three chips.

    Debugger
    nRF9160
    nRF52840

    When you measure on the nRF_VDD, you only measure the power consumption of the nRF9160.

    I suggest you stick to ampere mode for measuring.

    Also see Getting started with current measurements on the nRF9160 for some tips.

    Regards,
    Sigurd Hellesvik

  • Why I changed to source mode was to be able to measure the SPI peripherals. If I go back to ampere mode, the peripherals are not included unless supplied by the VDD_nRF but that voltage is not enough to use the peripherals. Can I assume the current draw from perihperals measured from source mode is the same in ampere mode? That is, in source mode, voltage from dk with sensors - voltage from dk = sensor consumption.

    Thank you Sigurd :)

  • nWre said:
    source mode was to be able to measure the SPI peripherals.

    Yes of course. So you will need to use Source mode.

    Sigurd Hellesvik said:
    I suggest you stick to ampere mode for measuring.

    Disregard my previous statement, I were confused for a bit since Source and Ampere showed different measurements.
    Then I found that the USB is supplying 5V, while in Source Mode the PPK2 is supplying 3.3V.
    This is the reason for the different current measurements. If you want Ampere mode to measure the same as Source, set the Power of the Source Mode to 5V. Be careful to check if your peripherals can handle 5V.

    So both Source Mode is fine.

    I still would recommend every part one at a time and sum it up once, it will give some more insight and a good double check of things.
    Then you can measure everything at once and know approx what you should get.

    Did this make sense?

    Regards,
    Sigurd hellesvik

Related