MicroSDHC Card and free space on R1


#1

From 1595_SNAP_PAC_R_series_user_guide.pdf
Displaying Free Space on the Card
If you need to know how many free bytes are left on a microSD/SDHC card, you can use PAC
Control or PAC Manager to read this data from an address in the controller’s memory map.
In a PAC Control strategy, for example, you could notify an operator if the card needs
replacing, based on the number of bytes still unused.

  1. Make sure the card is in the controller.
  2. In PAC Control, use the command Read Number from I/O Unit Memory Map to read
    memory map address F7002204. Use Integer 32 Variable in Argument 2.
    For more information, see “I/O Unit—Memory Map Commands” in Chapter 10 of the
    PAC Control User’s Guide, and see “Read Number from I/O Unit Memory Map” in the
    Command Reference or Help.)
  3. In PAC Manager, open the Inspect window for the controller. Click Other and choose
    Generic Read/Write from the popup menu. In the Address field, type F7002204. From
    the Type dropdown list, choose 32-bit Integer. Leave the Length as 1. Click Refresh.
    The number of bytes appears in the Value column.

I am trying 3. in PAC Manager
Choose Type:
32-Bit Integer “Refresh” -1385496576
32-Bit Integer (HEX) “Refresh” AD6B0000

How much space is left? It is a near empty 16 GB microSCHC card. Obviously, I am doing something wrong. Can someone point out my mistake?

Thank you


#2

Looks like a limitation from back when only 2GB cards were supported. A 32 bit unsigned int can only represent 4GB of free space. I would send an e-mail off to support, maybe there is an update to the memory map that has this value as a 64-bit integer - I don’t see it in the memory map docs though.


#3

Check your controller firmware version. We tweaked it to allow for larger SD cards.


#4

Unfortunately, you can’t show 16GB of free space in bytes in a 32 bit uint. Has that been updated? I don’t see it in the OptoMMP protocol guide.


#5

Yeah, I missed that. 32 bit integer can’t be large enough to display it correctly.

My R1 has:
Loader Version R6.2b
FW Version R9.5e

…and yeah if I choose 64 bit integer or HEX, it doesn’t read it.


#6

The cards I got for my client are only 2Gb. So this isn’t a big issue at the moment. I was just testing my code on my system and the only MicroSD card I have in my possession is this 16Gb card.


#7

You could partition your SD card down to 2GB if you want to test with it, but it would be nice to have a method to check the free space on larger cards - can you even buy 2GB cards anymore???


#8

Yes, they are $8-10 on amazon/walmart. I tried formatting mine down to 2GB last night, but I can’t in windows. Thought I read somewhere you have to use an actual program to format a MicroSD card.


#9

You may be able to use diskpart from an administrative command prompt. There is bits of information in the following superuser question.

Beware that it is possible to mess up the SD card security stuff and it may never work again though.


#10

Hi Guys,
Any reason NOT to use this handy “Get Available File Space” command for exactly this purpose? Am I missing something here?
Thanks,
Mary


#11

Looks like some documentation updates are needed.
I’m on it.
(Sorry it wasn’t there before you encountered your problem, @Drenton, but thanks for helping us improve the docs for the future.)


#12

Yes, that will work.

nFile_Space = GetAvailableFileSpace(9);

I was just checking it out in PAC Manager… I assume the process to see it in PAC Manager still won’t work?


#13

Good question, I’ll forward it to our support team. Looks like we need to update the mem map to accommodate, but I’m kinda guessing, stay tuned…


#14

Hi All,
Update on this OptoMMP address 0xF7002204, the fix is making it’s way through QA and will be in a future (most likely 9.6) firmware release, details here:
http://www.opto22.com/site/knowledgebase/kb_view_article.aspx?aid=2752

But I think that “GetAvailableFileSpace” was going to be fine your purposes, @Drenton, yes?
Thanks,
Mary


#15

Yes, this command will be just fine with what I am trying to accomplish.
Thx Mary
Have a great weekend.


#16

FYI - beta/fix coming soon: * Fix added to B9.5g 3/26/18 and later, Added new memory map location (xF7002208) that returns free space as an unsigned 64-bit integer.