A problem about downloading bin code to my SAMA5D22 board

Moderator: nferre

Oleksandr
Posts: 6
Joined: Thu Nov 02, 2017 10:30 pm

A problem about downloading bin code to my SAMA5D22 board

Mon Feb 05, 2018 4:59 pm

I’m busy with developing board with SAMA5D22 CPU and W25Q16BV serial flash. The serial flash is connected to SPI1 to the following pins:

Code: Select all

CPU		Signal		SerialFlash

P9   (PA22)	SPCK		6 (CLK)
P10 (PA23)	MOSI		5 (DI)
N10 (PA24)	MISO		2 (DO)
L10 (PA25)	NPCS0		1 (CS)
Moreover, the signal NPCS0 passed via the NL17SZ126DFT2G buffer for choosing a boot source. This is an equivalent of the BOOT_DIS jumper on the SAMA5D2-Xplained board.

The state of fuses and buregs are:

sam-ba -p usb -d sama5d2 -a bootconfig -c readcfg:bscr -c readcfg:bureg0 -c readcfg:bureg1 -c readcfg:bureg2 -c readcfg:bureg3 -c readcfg:fuse
Opening serial port 'COM23'
Connection opened.
Executing command 'readcfg:bscr'
BSCR=0x00000000 / BUREG0
Executing command 'readcfg:bureg0'
BUREG0=0x00000000 / QSPI0_IOSET1,QSPI1_IOSET1,SPI0_IOSET1,SPI1_IOSET1,NFC_IOSET1,SDMMC0,SDMMC1,UART1_IOSET1,JTAG_IOSET1
Executing command 'readcfg:bureg1'
BUREG1=0x00000000 / QSPI0_IOSET1,QSPI1_IOSET1,SPI0_IOSET1,SPI1_IOSET1,NFC_IOSET1,SDMMC0,SDMMC1,UART1_IOSET1,JTAG_IOSET1
Executing command 'readcfg:bureg2'
BUREG2=0x00000000 / QSPI0_IOSET1,QSPI1_IOSET1,SPI0_IOSET1,SPI1_IOSET1,NFC_IOSET1,SDMMC0,SDMMC1,UART1_IOSET1,JTAG_IOSET1
Executing command 'readcfg:bureg3'
BUREG3=0x00000000 / QSPI0_IOSET1,QSPI1_IOSET1,SPI0_IOSET1,SPI1_IOSET1,NFC_IOSET1,SDMMC0,SDMMC1,UART1_IOSET1,JTAG_IOSET1
Executing command 'readcfg:fuse'
FUSE=0x00000000 / QSPI0_IOSET1,QSPI1_IOSET1,SPI0_IOSET1,SPI1_IOSET1,NFC_IOSET1,SDMMC0,SDMMC1,UART1_IOSET1,JTAG_IOSET1
Connection closed.

For writing to the serial flash chip the softpack.bin file using SAM-BA over USB interface I use the following command:
sam-ba -p usb -d sama5d2 -a serialflash:xxxx -c erase:0x8000:0x58000 -c write:softpack.bin:0x8000

For reading from the serial flash chip I use following command:
sam-ba -p usb -d sama5d2 -a serialflash:xxxx -c read: softpack.bin:0x8000:70656

And now a question: what command line parameters I should use for the serialflash command?

I used the following table for SPI Serial Flash configuration

Code: Select all

Instance	Peripheral		I/O Set		Chip Selects
0		SPI0			1, 2			0, 1, 2, 3
1		SPI1			1, 2			0, 1, 2, 3
1		SPI1			3			0, 1, 2
2		FLEXCOM0		1			0, 1
3		FLEXCOM1		1			0, 1
4		FLEXCOM2		1, 2			0, 1
5		FLEXCOM3		1, 2, 3		0, 1
6		FLEXCOM4		1, 2, 3		0, 1
to choose options that you can read in lines below:

sam-ba -p usb -d sama5d2 -a serialflash:3:1:0:33 -c read: softpack.bin:0x8000:70656
and
sam-ba -p usb -d sama5d2 -a serialflash:1:2:0:33 -c read: softpack.bin:0x8000:70656

In fact, I tried all the options, and SAM-BA could not connect to the flash…
As a result, I got the following error: Applet.qml: 232: Error: could not initialize the applet (status: 1)
What it means? How can I fix it? Help me, please. I’m open for any questions.
blue_z
Location: USA
Posts: 1598
Joined: Thu Apr 19, 2007 10:15 pm

Re: A problem about downloading bin code to my SAMA5D22 board

Wed Feb 07, 2018 2:43 am

Oleksandr wrote:I’m busy with developing board with SAMA5D22 CPU and W25Q16BV serial flash.
So you have a custom board.
What functional tests have you performed on your board to prove functionality?
What are the differences between your board versus the Atmel reference design represented by the SAMA5D2 Xplained Ultra?
What modifications have you made to SAM-BA to account for these differences?
What version of SAM-BA are you using?

Regards
Oleksandr
Posts: 6
Joined: Thu Nov 02, 2017 10:30 pm

Re: A problem about downloading bin code to my SAMA5D22 board

Fri Feb 09, 2018 11:10 am

>> What functional tests have you performed on your board to prove functionality?

No tests were performed because this is a new board

>> What are the differences between your board versus the Atmel reference design represented by the SAMA5D2 Xplained Ultra?

Other pins are used to connect the serial memory. I pointed them out above.

>> What modifications have you made to SAM-BA to account for these differences?

No changes were made to the SAM-BA. I use serialflash applet and its command line parameters

>> What version of SAM-BA are you using?

I use SAM-BA 3.2.1 version
blue_z
Location: USA
Posts: 1598
Joined: Thu Apr 19, 2007 10:15 pm

Re: A problem about downloading bin code to my SAMA5D22 board

Tue Feb 13, 2018 12:05 am

Oleksandr wrote:And now a question: what command line parameters I should use for the serialflash command?
...
In fact, I tried all the options, and SAM-BA could not connect to the flash…
The command help displays

Code: Select all

Syntax: serialflash:[<instance>]:[<ioset>]:[<npcs>]:[<frequency>]
Parameters:
    instance   SPI controller instance
    ioset      I/O set
    npcs       SPI chip select number
    frequency  SPI clock frequency in MHz
So for your case :
<instance> would be 1 for SPI1;
<ioset> would be 2 according to datasheet Table 6-2: Pin Description;
<npcs> would be 0 for NPCS0.
For `frequency`you seem to like 33, but for an untested new board, a much slower speed would be prudent.

Oleksandr wrote:No tests were performed because this is a new board
Then you don't seem to understand what functional tests are, and the sane way to bring-up a board.
Until you have tested voltages and clocks, and performed comprehensive memory tests, there are too many unknowns to start debugging software.


Regards

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 1 guest