Initial Flash Programming

Questions for programming 8051 microcontrollers in C or assembly using SDCC

Initial Flash Programming

Postby superchris » Wed Jan 21, 2009 12:23 pm

I'm working with the nRF24LE1 right now and I'm having a little bit of trouble getting it programmed for the first time. From what I've gathered from the blog it seems like you're flashing the chip-side bootloader to the chip using the PC-side bootloader, which uses the RX and TX lines of the chip. How is this possible? It looks to me (from the datasheet and support page on Nordic's website) like the only way to program empty flash is through the SPI lines. Nordic states that it "programs like any other SPI flash device." I've tried programming the chip-side bootloader using PonyProg's spi flash feature but always with a "write failed" message at the end. As a last resort I built the programmer suggested on the blog and tried to program that way, but I always get a "device not connected" message. Any ideas as to what I should be doing?
superchris
 
Posts: 1
Joined: Wed Jan 21, 2009 12:12 pm

Re: Initial Flash Programming

Postby brennen » Wed Jan 21, 2009 12:35 pm

I have a home-made programmer that I built using an NXP LPC2148 microcontroller to program the initial bootloader into the 24LU1. In order for the PC-side bootloader to do anything, the microcontroller-side bootloader has to be programmed over the SPI interface. Are you setting the PROG pin for the entire duration of programming and verifiying? If you don't, you can't access the FLASH over SPI.

Also, I'm not totally sure that the microcontroller-side bootloader is compatible with the 24LE1. I know that the FLASH memory is in the same space, but I think the RAM is different. Also, if the addresses of any of the registers used by the bootloader are different, then it will also not work. I don't think the PC-side programmer needs to be changed, but I would have to look at the source to be sure. I think it only worries about the FLASH memory area, which is the same for both chips.
brennen
Site Admin
 
Posts: 157
Joined: Sun Aug 17, 2008 10:15 am

Re: Initial Flash Programming

Postby patadino » Wed Feb 18, 2009 5:51 pm

Hi!...
...finally I could get some samples of the nRF24LE1 to test the performance os this little chips. I have been working on a SPI Flash programmer for program the chip. I use a small PCB with a microchip 18LF2550@3.3V to make the PC-SPI brisge and program the device, but I have found some problems...I hope you can help me to don't burn my head!...

1)When I make the erase block command and later make a read command I chack that I haven't all the registers set to 0xFF value. For example I have the following content in the flash:

0000h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0010h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0020h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0030h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0040h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0050h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0090h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00A0h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00B0h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00C0h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF..... and the same until 3FFF....Can anyone help me to explain it?...


For the erase block command I have made the following steps (after putting initially PROG=1):
1) WREN (Write enable)
2) nCS low
3) Send in a bucle: 0x52->0x00
4) nCS=1 and then wait for (WREN=0)
5) Later...the same for all pages 0x52 -> 0x00...


2)I have checked the flash memory after programming and it has some mistakes when I program the flash. I make the program sequence but the data stored is wrong, sometimes it writes some bits wrong and sometimes don't write anything in the register....Why can be this?....

Brennen, guys, can anyone help me to advance?...thans a lot
When I have finished and make work the programmer I will put here for share with all
Regards
patadino
 
Posts: 2
Joined: Wed Feb 18, 2009 5:35 pm

Re: Initial Flash Programming

Postby brennen » Wed Feb 18, 2009 6:46 pm

Have you looked at the SPI signals on a scope? You may have an error in your code somewhere that is causing the device to program incorrectly. Also, you may be trying to operate the SPI interface at too high of a speed, so you might want to check that out. Finally, are you checking to make sure the write operation has completed before you do any more operations?
brennen
Site Admin
 
Posts: 157
Joined: Sun Aug 17, 2008 10:15 am

Re: Initial Flash Programming

Postby patadino » Thu Feb 19, 2009 8:15 am

1)Have you looked at the SPI signals on a scope?...No I haven't looked, but It's extrange that the WREN command and RDSR command works OK!, but when I erase all the Flash Program blocks (0 to 31) and read after that the memory result is:

0000h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0010h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0020h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0030h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0040h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0050h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

There are some bits that don't erase and don't do nothing....

2) When I program the memory, for example with : AA BB CC DD EE starting at 0x0000 the result of reading the memory is:
0000h AB BA CD DC EF FF FF FF FF FF FF FF FF FF FF FF
0010h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0020h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0030h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0040h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0050h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070h 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080h AB BA CD DC EF FF FF FF FF FF FF FF FF FF FF FF
0090h FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

...the memory is not right programmed, allways fail writing the last bit I don't know why!...

3) I have checked the SPI functions and commands and I haven't seen any error...Any other IDEA?¿...

4) I have checked the timing that appear to be OK!...and then WREN and RDSR works OK!

...I will build a new PCB with new components to discard bad chip hardware...

...Thanks a lot Brennen...





You may have an error in your code somewhere that is causing the device to program incorrectly. Also, you may be trying to operate the SPI interface at too high of a speed, so you might want to check that out. Finally, are you checking to make sure the write operation has completed before you do any more operations?
patadino
 
Posts: 2
Joined: Wed Feb 18, 2009 5:35 pm

Re: Initial Flash Programming

Postby clarkent » Thu Mar 12, 2009 4:50 pm

You can also check out this topic on a programmer for the nRF24LE1;
http://www.nrftalk.net/forum/viewtopic.php?f=17&t=15
clarkent
 
Posts: 1
Joined: Thu Mar 12, 2009 4:40 pm

Re: Initial Flash Programming

Postby kams » Mon Feb 22, 2010 7:34 am

I have the same troble trying program LU1 via SPI interface.
As SPI master I use LPC2368 board, connected to PC by uart.
Any commands work fine (wren, read sfr, etc), buf read-after-write verification failed.
I have incorrect last bits at almost every byte! Patadino already talked about this problem.
SPI clock is use is about 1MHz. I haven't scope to watch signals.

read algorithm:
CS_lo
send 0x03 (READ)
send addr_hi
send addr_lo
read 256 bytes
CS_hi

write algorithm:
CS_lo
send 0x06 (WREN)
CS_hi
CS_lo
send 0x02 (PROGRAM)
send addr_hi
send addr_lo
write 256 bytes
CS_hi

Decreasing clock rate, insertion delays does not give result (all the same).

Please help!
Can anybody share sources for LU1 programming?
kams
 
Posts: 2
Joined: Mon Feb 22, 2010 7:13 am


Return to 8051 Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron