Hi,
I am using an RCM3000 Rabbit module with Dynamic C v9.62. I am trying to save some settings to the user block using the provided write function which I can then read back later even after power has been removed.
Now as far as I am aware this writes to the flash memory and as such should still be there after power is removed. As I can gather this is the purpose of the user block (ie for saving settings as an example).
When I turn the power off and then on again and load my program I am not getting back the value I had previously saved.
I have taken a snippet out of my code if it helps, I am fairly sure that I am using the user block functions correctly as when power is applied I can write and read without a problem, its only when I do a power cycle and then try to read from the user block that I am having a problem recalling the data. Perhaps it is my associated C code that isn’t up to scratch?!
//Save All Rabbit Settings
case 0x64:
temp=get_port_pins(PORTA);
user_block_data=&temp;
printf("Mem Loc=%X Data=%X Bytes=%u
", (SysIDBlock.userBlockLoc+user_block_addr_offset), *user_block_data, user_block_size);
return_value=writeUserBlock(user_block_addr_offset, user_block_data, user_block_size);
//clear user_block data for testing purposes
temp=0x00;user_block_data=&temp;
switch(return_value)
{
case 0:
printf("writeUserBlock: Success
");
break;
case -1:
printf("writeUserBlock: Invalid address or range
");
break;
case -2:
printf("writeUserBlock: No valid System ID block found
");
break;
case -3:
printf("writeUserBlock: Flash writing error
");
break;
default:
break;
}
break;
//Load All Rabbit Settings
case 0x65:
return_value = readUserBlock(user_block_data, user_block_addr_offset, user_block_size);
switch(return_value)
{
case 0:
printf("readUserBlock: Success
");
set_port_pins(PORTA, *user_block_data);
printf("Mem Loc=%X Data=%X Bytes=%u
", (SysIDBlock.userBlockLoc+user_block_addr_offset), *user_block_data, user_block_size);
break;
case -1:
printf("readUserBlock: Invalid address or range
");
break;
case -2:
printf("readUserBlock: No valid System ID block found
");
break;
default:
break;
}
break;
I tried following the user block sample provided, which uses the “array type” functions so in order to just simplify it for my beginner mind I am just trying to write and read a single byte of data (I’m reading the port A values in my code above).
Please bear with me as my C coding skills are not as good as I would like and to make matters worse I am new to the Rabbit modules!
Any help you can offer will be very much appreciated as I am now stuck on this issue!!