STM32 Programmer for NRF 8051 supported

Discussion about wireless devices

STM32 Programmer for NRF 8051 supported

Postby Val_simbia » Mon Jan 21, 2013 7:17 pm

Dear Brennen I came across an excellent example of yours where you let it to public source code to support programming hardware based on LPC ARM controller.
I went through all files and I saw they can be transferred to make a project we say in Keil for STM32 controller . Just for any of STM32F or STM32L series to build a programmer hardware for NRF24LE1
I only wonder of one thing...
I got rfid tags from manufacturer and they let me to modyfy then ( i e erase all and write my own code) the only thing i am still wary is INFO page. I saw a function it seems treating info page in your source codes but it was not used. If you could propm me how would i treat info page in order not to make device nonfunctional by accidet :) Is it only a matter of bit in certain register to set in order to write or read INFO page. Do you think you could provide a short example or a unction where INFO page could be securely read and saved eventually. And another question if NRF24LE is locked for all possible locks is it still really possible to get access to flash by means of ERASE all? thank you very much for your help. Val. Kaliningrad. Russia
Val_simbia
 
Posts: 3
Joined: Mon Jan 21, 2013 7:01 pm

Re: STM32 Programmer for NRF 8051 supported

Postby brennen » Tue Jan 22, 2013 1:39 pm

Val_simbia wrote:If you could propm me how would i treat info page in order not to make device nonfunctional by accidet

So long as you don't set FSR.INFEN, then the ERASE ALL command (0x62) won't erase the InfoPage. You can also just erase each of the 32 program memory pages individually with the ERASE command (0x52 then the page number), and that's what I do in my code.

Val_simbia wrote: Do you think you could provide a short example or a unction where INFO page could be securely read and saved eventually.

In order to read the InfoPage, you would first set FSR.INFEN and then issue a READ command (0x03) followed by 0x00 and 0x00 (the two bytes of the start address, or 0x0000). However, don't bring the FCSN pin back to high yet. To read bytes, you send a dummy byte over SPI (the value doesn't matter...just use 0x00), and then read the value that the nRF24LE1 returns. The first byte read will be the first byte of the InfoPage at address 0x0000. Each byte read from there on automatically increments to the next byte. Read out 512 bytes and you have the entire InfoPage (bring FCSN back to high once you read out all 512 bytes, of course).

Val_simbia wrote:And another question if NRF24LE is locked for all possible locks is it still really possible to get access to flash by means of ERASE all?

I have never tried this, but the datasheet says that you can clear the lock with the ERASE ALL command. Do keep in mind that you want to make sure that FSR.INFEN is 0 before you do this, so that you don't erase the InfoPage. Also note that this will delete all of the flash memory that's currently stored in the device.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: STM32 Programmer for NRF 8051 supported

Postby Val_simbia » Wed Jan 23, 2013 7:25 pm

Dear Brennen thank you for your kind help. Although I am thinking of purchasing some ready made programmer but if i manage to encourage myself to try self brewed i only need to clarify certain points.
I understand that successful attempt to read INFO page would demonstrate that basic preparation " to talk to Nordic" is done since as i presume reading INFO page is always accessible and safe procedure.
In respect of programming in general :

Do I understand right - once the info page is READ - i do my changes in this pile of hex numbers to modify info page on my liking and store it in a file of bin format.

is the next step is right step?

I enter programming mode (In data sheet they mention about PMW bit4 in PCON register - must it be done in source code already OR IS THERE A WAY to access PCON otherwise?) then I do ERASE ALL then load by means of USART into my programmer stm32 chip info page file and load it by SPI to NORDIC? Then i must be reading INFO page and verifying it is ok after that I can start downloiading
precompiled ( we say Keil 51C bin. or hex. file? - which format would be acceptable in this case?) file into flash

Are they right steps to start successful programming?
thank you for your help.Val
Val_simbia
 
Posts: 3
Joined: Mon Jan 21, 2013 7:01 pm

Re: STM32 Programmer for NRF 8051 supported

Postby brennen » Wed Jan 23, 2013 7:37 pm

First off, you should never need to read or write the InfoPage (at least I've not found a reason for it). Ever. Just make sure that you don't set FSR.INFEN before you do an ERASE ALL command and you should be good (I don't read or write the InfoPage at all in my programming code that I'm aware of).

I would *highly* suggest you copy as much of my programming code as you possibly can (http://www.diyembedded.com/files/nrf24le1_based_programmer.zip). It literally does everything you would need to program these chips, other than programming the NVRAM. You would really only need to change the functions for the UART (for the user to use the program) and SPI (to have your STM32 program the LE1) over to ones made for your chip.

Finally, unless you really dislike the on-chip bootloader, it's far easier just to use it to program your board, at least in my opinion. You just need to wire up RXD, TXD, and !RESET over to an FT232R's TXD, RXD, and RTS, respectively, and you're ready to program the device.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: STM32 Programmer for NRF 8051 supported

Postby Val_simbia » Tue Jan 29, 2013 11:28 am

Dear Brennen thank you for your help .I managed to build a programmer and it works . The only thing I wondered in the beginning when I tryed to read INFO page ( well, temptation overcame ) in presumably locked by manufacturer tag - all DSYS bytes showed difference and it is normal but after those 32 bytes of DSYSI kept on getting FF FF FF till the end of INFO page. It looked like info page declared of unprotected code residing in Main block ( i e flash). Then I tried to read Flash - same story FF FF FF all 16 or 18 kilobytes ( can recall exact figure) - so flash looked like it was protected!? I left all guessings for now and decided to write something in flash and success. short code worked and retained in flash after reapplying power and i could read my code out of flash. I did not try to play with locking or protecting and seeing what is going on in INFO page at this stage. Still wonder whether you will not see in info PAGE that code was protected one can see it only attempting to read flash or perhaps it was not locked but then a question why i could not read what was in working tag flash memory :):). ( I do not need manufacture code like I said i got permition from him to modify on my liking) thank you.
Val_simbia
 
Posts: 3
Joined: Mon Jan 21, 2013 7:01 pm

Re: STM32 Programmer for NRF 8051 supported

Postby brennen » Tue Jan 29, 2013 1:02 pm

Val_simbia wrote:Dear Brennen thank you for your help .I managed to build a programmer and it works.

Good news! You're welcome!

Val_simbia wrote:...all DSYS bytes showed difference and it is normal but after those 32 bytes of DSYSI kept on getting FF FF FF till the end of INFO page

I think only a small portion of the InfoPage is actually used (the rest of it would be 0xFF). The main purpose of the InfoPage is to allow the manufacturing line to tune parameters that can be slightly different between individual ICs.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm


Return to Wireless

Who is online

Users browsing this forum: No registered users and 1 guest

cron