Blinking LED on SAMA5D4 Xplained Ultra

Moderator: nferre

xargs
Posts: 3
Joined: Wed Jan 29, 2020 9:52 pm

Blinking LED on SAMA5D4 Xplained Ultra

Wed Jan 29, 2020 10:49 pm

I'm trying to run the "Getting started" demo from atmel-software-package/examples/getting_started. I believe I should be able to run this example out of SRAM. I've built the code with:

make TARGET=sama5d4-xplained VARIANT=sram

which results in a getting-started.bin in the build/sama5d4-xplained/sram directory.

Then,

sam-ba_3.3.1/sam-ba -p serial -b sama5d4-xplained -t 5 -a nandflash -c erase

sam-ba_3.3.1/sam-ba -p serial -b sama5d4-xplained -t 5 -a nandflash -c write:build/sama5d4-xplained/sram/getting-started.bin

Everything runs without errors, but D10 just remains on steady.

What am I doing wrong?
blue_z
Location: USA
Posts: 2101
Joined: Thu Apr 19, 2007 10:15 pm

Re: Blinking LED on SAMA5D4 Xplained Ultra

Fri Jan 31, 2020 12:48 am

xargs wrote: I'm trying to run the "Getting started" demo from atmel-software-package/examples/getting_started.
Which version?
What toolchain are you using?

xargs wrote: Then,
...
sam-ba_3.3.1/sam-ba -p serial -b sama5d4-xplained -t 5 -a nandflash -c write:build/sama5d4-xplained/sram/getting-started.bin
That's a reckless way to use the SAM-BA write command; you haven't specified a NAND displacement.
You're installing a boot program, but not using the 'writeboot' command, which would install the PMECC parameters header and fix up the ARM exception vector for the binary.
The NAND chip should be ONFI compliant, so the missing PMECC header is of no consequence.
But my build of the 2.17 example does not have a proper ARM exception vector that satisfies the RomBOOT requirements, so I'm surprised your install seems to boot.

xargs wrote: Everything runs without errors, but ...
You have to elaborate because that's a statement that conveys no diagnostic information.
xargs wrote: ... D10 just remains on steady.
Are you reporting the correct part number? What color is this LED?
(At least you wrote this description concisely, i.e. without using a negative.)
There are four LEDs on the SAMA5D4-XULT. Two are red, and two are blue.
I can get three of the LEDs (including both "user" LEDs) to blink with the program.

What is each LED doing on program start?
(Seems like the program documentation is inaccurate/ambiguous: "Two LEDs should start blinking on the board". I do see "two" blinking LEDs, but it's not the two "user" LEDs.)

What happens when you press the user push button?

What happens when you use the four command keys?
For that matter, what is displayed on the serial console?

According to your previous claim about "everything", all of these input directives perform as expected?
Assuming "everything" includes the four command keys, then "D10 just remains on steady" has to imply that these command keys are ineffective, and therefore do not "run[s] without errors"!

Regards
xargs
Posts: 3
Joined: Wed Jan 29, 2020 9:52 pm

Re: Blinking LED on SAMA5D4 Xplained Ultra

Fri Jan 31, 2020 8:56 am

atmel-software-package Version 2.17 - 2019-09

gcc version 8.2.1 20181213 (release) [gcc-8-branch revision 267074] (GNU Tools for Arm Embedded Processors 8-2018-q4-major)

By "everything runs without errors", I was referring to the make and sam-ba command lines.

The LED I was referring to is blue and labeled "D10 USER".
What is each LED doing on program start?
I have no reason to believe the program is actually starting, but D10, D8, and D4 are on solid, and D6 is off. The BP1 button has no effect on the LEDs.
build of the 2.17 example does not have a proper ARM exception vector that satisfies the RomBOOT requirements
This is my first foray into this type of part, but my getting-started.bin starts with

Code: Select all

0000000  18 F0 9F E5 18 F0 9F E5 18 F0 9F E5 18 F0 9F E5
0000010  18 F0 9F E5 00 00 00 00 14 F0 9F E5 14 F0 9F E5
and I was under the impression the E5 bytes were what the boot ROM was looking for.

I see RomBOOT on the serial console when I press the RESET button, and nothing else. Typing 0, 1, 2, s, or b on the console has no effect on the LEDs and no response on the console.
blue_z
Location: USA
Posts: 2101
Joined: Thu Apr 19, 2007 10:15 pm

Re: Blinking LED on SAMA5D4 Xplained Ultra

Mon Feb 03, 2020 11:27 pm

The solution to your boot failure has already been mentioned, i.e. use the SAM-BA 'writeboot' command.

Regards
xargs
Posts: 3
Joined: Wed Jan 29, 2020 9:52 pm

Re: Blinking LED on SAMA5D4 Xplained Ultra

Tue Feb 04, 2020 12:12 am

Thanks, "writeboot" was the missing bit.
karoury
Posts: 1
Joined: Wed Mar 04, 2020 12:16 pm

Re: Blinking LED on SAMA5D4 Xplained Ultra

Wed Mar 04, 2020 3:08 pm

I have stumbled to the same problem of running getting-started example from the Atmel software package in the sama5d4 xplained board.
I have built the application using gcc-arm-none-eabi5-4 2016 toolchain correctly but had to exclude USART and USART_ISO files from the project by setting 'CONFIG_HAVE_USART' and 'CONFIG_HAVE_USART_ISO7816' in Makefile.vars.sama5d4 file to 'n' because it couldn't be built otherwise and kept getting me errors of not declared variables of US_CSR_CMP which when I check in sama5d4 datasheet don't even exist.
I have managed to flash it to NAND flash using sam-ba but had no luck in flashing it to serial flash.I have used writeboot as stated earlier in this thread.
When I connected the board to a terminal and rebooted, all it shows is "RomBOOT" and no further. but one of the LEDs started blinking.
Now what I suspect is that the application has been loaded correctly from flash but it has problem printing "Getting Started Example" as written in the example code. I doubt it has something to do with the excluding of usart files I did earlier.

Hope One can help me here.
blue_z
Location: USA
Posts: 2101
Joined: Thu Apr 19, 2007 10:15 pm

Re: Blinking LED on SAMA5D4 Xplained Ultra

Fri Mar 06, 2020 4:38 am

karoury wrote: I have built the application using gcc-arm-none-eabi5-4 2016 toolchain correctly but ...
No, you have not built the SoftPack application "correctly".
Your attempts to workaround whatever build issue(s) you have are misguided.
There is simply no reason to modify any SoftPack files in order to build the getting-started example for SRAM.

I don't recognize the toolchain name you provided (are there typos?), but I do have a gcc-arm-none-eabi-5_4-2016q3 toolchain that builds the getting-started example for SRAM without any hacks or errors.

Code: Select all

/home/at91/softpack_v2.17/examples/getting_started$ echo $PATH
/opt/gcc-arm-none-eabi-5_4-2016q3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
/home/at91/softpack_v2.17/examples/getting_started$ echo $CCFLAGS
-I/opt/gcc-arm-none-eabi-5_4-2016q3/include

/home/at91/softpack_v2.17/examples/getting_started$ make TARGET=sama5d4-xplained VARIANT=sram
DEP ../../examples/getting_started/main.c
DEP ../../target/sama5d4/toolchain/gnu/cstartup.S
DEP ../../drivers/serial/usartd.c
DEP ../../drivers/serial/usart.c
DEP ../../drivers/serial/uart.c
DEP ../../drivers/serial/dbgu.c
DEP ../../drivers/serial/seriald.c
DEP ../../drivers/serial/console.c
DEP ../../drivers/peripherals/wdt.c
DEP ../../drivers/peripherals/tcd.c
DEP ../../drivers/peripherals/tc.c
DEP ../../drivers/peripherals/slowclock_sckc.c
DEP ../../drivers/peripherals/shdwc.c
DEP ../../drivers/peripherals/rtc.c
DEP ../../drivers/peripherals/rstc.c
DEP ../../drivers/peripherals/pwmc.c
DEP ../../drivers/peripherals/pmc.c
DEP ../../drivers/peripherals/pit.c
DEP ../../drivers/peripherals/matrix.c
DEP ../../drivers/peripherals/bus.c
DEP ../../drivers/nvm/nand/nfc.c
DEP ../../drivers/nvm/sfc.c
DEP ../../drivers/mm/l2cache_l2cc.c
DEP ../../drivers/mm/cache.c
DEP ../../drivers/led/led.c
DEP ../../drivers/irq/irq.c
DEP ../../drivers/irq/aic5.c
DEP ../../drivers/gpio/pio3.c
DEP ../../drivers/extram/smc.c
DEP ../../drivers/extram/mpddrc.c
DEP ../../drivers/extram/ddram.c
DEP ../../drivers/dma/xdmac.c
DEP ../../drivers/dma/dma_xdmac.c
DEP ../../drivers/dma/dma.c
DEP ../../target/sama5d4/board_sama5d4-xplained.c
DEP ../../target/sama5d4/board_support.c
DEP ../../target/sama5d4/chip.c
DEP ../../target/common/board_led.c
DEP ../../target/common/chip_common.c
DEP ../../target/common/board_timer.c
DEP ../../target/common/board_console.c
DEP ../../utils/timer.c
DEP ../../utils/syscalls.c
DEP ../../utils/trace.c
DEP ../../utils/rand.c
DEP ../../utils/intmath.c
DEP ../../utils/callback.c
DEP ../../arch/arm/mmu_cp15.c
DEP ../../arch/arm/l1cache_cp15.c
DEP ../../arch/arm/fault_handlers.c
DEP ../../arch/arm/mutex.c
CC ../../target/sama5d4/toolchain/gnu/cstartup.S
CC ../../examples/getting_started/main.c
CC ../../arch/arm/mutex.c
CC ../../arch/arm/fault_handlers.c
CC ../../arch/arm/l1cache_cp15.c
CC ../../arch/arm/mmu_cp15.c
AR build/sama5d4-xplained/sram/arch/arch.a
CC ../../utils/callback.c
CC ../../utils/intmath.c
CC ../../utils/rand.c
CC ../../utils/trace.c
CC ../../utils/syscalls.c
CC ../../utils/timer.c
AR build/sama5d4-xplained/sram/utils/utils.a
CC ../../target/common/board_console.c
CC ../../target/common/board_timer.c
CC ../../target/common/chip_common.c
CC ../../target/common/board_led.c
CC ../../target/sama5d4/chip.c
CC ../../target/sama5d4/board_support.c
CC ../../target/sama5d4/board_sama5d4-xplained.c
AR build/sama5d4-xplained/sram/target/target.a
CC ../../drivers/dma/dma.c
CC ../../drivers/dma/dma_xdmac.c
CC ../../drivers/dma/xdmac.c
CC ../../drivers/extram/ddram.c
CC ../../drivers/extram/mpddrc.c
CC ../../drivers/extram/smc.c
CC ../../drivers/gpio/pio3.c
CC ../../drivers/irq/aic5.c
CC ../../drivers/irq/irq.c
CC ../../drivers/led/led.c
CC ../../drivers/mm/cache.c
CC ../../drivers/mm/l2cache_l2cc.c
CC ../../drivers/nvm/sfc.c
CC ../../drivers/nvm/nand/nfc.c
CC ../../drivers/peripherals/bus.c
CC ../../drivers/peripherals/matrix.c
CC ../../drivers/peripherals/pit.c
CC ../../drivers/peripherals/pmc.c
../../drivers/peripherals/pmc.c: In function 'pmc_ext32k_monitor':
../../drivers/peripherals/pmc.c:1602:15: warning: unused variable 'count' [-Wunused-variable]
  volatile int count;
               ^
CC ../../drivers/peripherals/pwmc.c
CC ../../drivers/peripherals/rstc.c
CC ../../drivers/peripherals/rtc.c
CC ../../drivers/peripherals/shdwc.c
CC ../../drivers/peripherals/slowclock_sckc.c
CC ../../drivers/peripherals/tc.c
CC ../../drivers/peripherals/tcd.c
CC ../../drivers/peripherals/wdt.c
CC ../../drivers/serial/console.c
CC ../../drivers/serial/seriald.c
CC ../../drivers/serial/dbgu.c
CC ../../drivers/serial/uart.c
CC ../../drivers/serial/usart.c
CC ../../drivers/serial/usartd.c
AR build/sama5d4-xplained/sram/drivers/drivers.a
LINK build/sama5d4-xplained/sram/getting-started.elf
OBJCOPY build/sama5d4-xplained/sram/getting-started.bin
/home/at91/softpack_v2.17/examples/getting_started$

karoury wrote: Now what I suspect is that ... it has problem printing "Getting Started Example" as written in the example code.
So you are claiming that there's a bug in the code? Really?

karoury wrote: I doubt it has something to do with the excluding of usart files I did earlier.
I do not agree with you, since I can replicate your symptom of a silent console by applying your misguided edits.

Regards

Return to “SAMA5-based”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests