Hi,
I was trying to store data, so I used the Configuration class. Since I needed to store large arrays (length of 0x100), I tried to use Configuration.Write(byte[] buffer). I’m not so sure what happened next, but the result is that now I can’t see the G120 in visual studio and in FEZ Config.
So far I tried :
- to reboot.
- to reboot with LDR0 and LDR1 low, to boot on GHI bootloader.
- to reboot with pin mode (P2.1) low to debug on serial.
But none of these made my G120 appear in visual studio/FEZ Config.
One strange thing is that trying to boot on the GHI bootloader don’t make appears a new COM port on my computer. So I can’t try a manual update.
Any help or hints on what to do now are more than welcome.
Tulmandil
@ Tulmandil - Holding down LDR0 and LDR1 on startup should not be affected by a bug in Configuration. Can you try on a different computer? Do you have the USB drivers installed? Does the device appear anywhere in the Device Manager?
Can you post the code that wrote to Configuration and a sample of the buffer that did so? Was the board freshly flashed when the code ran or has it been running for awhile?
Thanks for the reply.
I’ve just tried on another computer, I don’t see the G120 on it.
I don’t know how to verify for the drivers, but I have the .Net Micro framework SDK 4.3 and the GHI Electronics NETMF SDK 2016 R1 installed on this computer. And before it was working fine.
The device does not appear in the Device Manager.
The board was freshly flashed.
My code was just to test if I was able to write the buffer and read it again after. The buffer is just a some dummy data to easily write and read them back.
byte[] myConfig = Configuration.Read();
for (int i = 0; i < 0xff; i++)
{
//D
myConfig[i] = (byte)i;
//Modulus
myConfig[i + 0x500] = (byte)i;
if (i < 0x80)
{
//DP
myConfig[i + 0x100] = (byte)i;
//DQ
myConfig[i + 0x200] = (byte)i;
//InverseQ
myConfig[i + 0x400] = (byte)i;
//P
myConfig[i + 0x600] = (byte)i;
if (i < 0x03)
{
//Exponent
myConfig[i + 0x300] = (byte)i;
}
}
}
bool isOK = Configuration.Write(myConfig);
@ Tulmandil - If you set the MODE pin to be in serial mode, do you see any messages printed out on startup when you hold down LDR0 and LDR1 then apply power?
@ John No, I see nothing. However, if I send a char on the serial, there is some king of echo but the echo is not constant.
My malfunctioning G120 is a Cobra II Rev C board, I forgot to mention this before.
I tested my setup to see the messages in serial from the GHI bootloader on a Cobra II Rev b board, and it worked.
@ Tulmandil - I believe this is a result of using Read/Write improperly. The documentation for Write that you can view in Visual Studio states: “Writes the given buffer to the configuration sector. The data written must come unmodified from a previous call to Read.” Write and Read are only meant for backup purposes – they do not operate on a general purpose storage buffer. Configuration stores more data than just the buffer you provide it. You want to use WriteEntry and ReadEntry which allow you to write arbitrary data.
You just happened to write some bytes to configuration that corrupt the device. The only way to be sure that is the issue and to fix it, if it is, is to send the device back to us for repair. You can contact support@ ghi and reference this thread to proceed with that. In a future SDK we will add more safe guards to prevent corrupting the device when using Configuration improperly and emphasize the constraints of Read/Write more.
@ John Ok, thank you for all your answers.
@ John - Configuration.Write should never overwrite a protected area of memory right?
@ Mr. John Smith - Configuration.Write never does. A corrupt configuration sector with a certain bit pattern causes this issue.