Sunday, April 08, 2007

At last! C2 Flash Programming the C8051F530TB

I spent a great part of the afternoon ploughing through the C2 commands being sent from Silabs' IDE, trying to find the clues I needed to get my embedded C2 programmer to work. I could see the packets of data becoming more dense after 100ms or so, but it was taking me more than an hour to analyse 10ms of data. I was just about there - though that doesn't mean much. As I noted earlier, there wasn't anything in the C2 traffic that actually looked like a device erase. Once I found a device erase command, I'd have to work back through the C2 commands to find out which one or combination actually accomplished the erase.

ec2drv now supports F530

Ricky was in touch about the ec2drv software, he'd looked through the debugging logs I'd sent him and spotted the messages that made writes and erases work. He mentioned the VDDMON register, as had one of the posters at the Silicon Labs forum I posted to, but included the register address (0xff) in his remark. That explains the WAffWD and WAffRD messages in the previous posts! After a quick read of the datasheet, it seems it's necessary to prepare the VDD monitor, allow it to settle (there's a flag to check), and then set it to a high level before flash programming or erasing. Once I'd added that to the code I'd written, it worked first time! Ec2drv seems to fully support the F530 now, so I'll be glad to get back to Linux for developing on the F530. All I needed was some way of writing my code to the Silicon Labs boards, and the only way (up until today) was by using their IDE on Windows.

If you're hung up on your implementation of Silicon Labs' AN127, and you're using F530 or F520 parts, all you need to do is to change the FPI initialisation to 0x02, 0x04, 0x01 (AN127 says 0x02, 0x01). And add the VDDMON setup code to your FPI initialisation. Happy flashing!

No comments: