Commit 60f2196b authored by Erik Strand's avatar Erik Strand
Browse files

DICE tests

parent fd9a459f
......@@ -9,7 +9,7 @@ MCU_DEFINE := __SAMD51J19A__
# Flags
LFLAGS += -mthumb -mabi=aapcs-linux -mlong-calls -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DSAMD51
CFLAGS += -x c -DDEBUG -Os -ffunction-sections -g3 -Wall -c -std=gnu99 $(LFLAGS)
CFLAGS += -x c -DDEBUG -ffunction-sections -g3 -Wall -c -std=gnu99 $(LFLAGS)
INCLUDES += -I"samd51" -I"samd51/CMSIS/Include" -I"samd51/include" -I"samd51/startup"
# List the subdirectories for creating object files
......
......@@ -3,23 +3,49 @@
int main (void) {
int i;
// red led is 17, green led is 19
// red led is A17, green led is A19 (lit when low)
REG_PORT_DIR0 = (1u << 17) | (1u << 19);
// green led
//REG_PORT_DIR0 |= (1u<<19);
// make sure they start off
REG_PORT_OUTSET0 = (1u << 17) | (1u << 19);
//REG_PORT_OUTCLR0 = (1u << 19);
//REG_PORT_OUTSET0 = (1u << 17);
// Prepare output signals (A5, A22)
REG_PORT_DIR0 |= (1u << 5) | (1u << 22);
// make sure they start low
REG_PORT_OUTSET0 = (1u << 5) | (1u << 22);
// Prepare input signals (A8, B13)
/*
PORT->Group[0].PINCFG[8].bit.INEN = 1;
PORT->Group[0].PINCFG[8].bit.PULLEN = 1;
PORT->Group[1].PINCFG[13].bit.INEN = 1;
PORT->Group[1].PINCFG[13].bit.PULLEN = 1;
*/
while(1) {
REG_PORT_OUTSET0 = (1u << 17);
REG_PORT_OUTCLR0 = (1u << 19);
// Listeners
/*
if ((REG_PORT_IN0 & (1u << 8)) || (REG_PORT_IN1 & (1u << 13))) {
// Turn on the LED.
REG_PORT_OUTCLR0 = (1u << 17) | (1u << 19);
// Raise the signal wires.
REG_PORT_OUTSET0 = (1u << 5) | (1u << 22);
} else {
// Turn off the LED.
REG_PORT_OUTSET0 = (1u << 17) | (1u << 19);
// Lower the signal wires.
REG_PORT_OUTCLR0 = (1u << 5) | (1u << 22);
}
*/
// Director
REG_PORT_OUTCLR0 = (1u << 17) | (1u << 19);
REG_PORT_OUTSET0 = (1u << 5) | (1u << 22);
for (i=0; i<1000000; i++) {
__asm("nop");
}
REG_PORT_OUTCLR0 = (1u << 17);
REG_PORT_OUTSET0 = (1u << 19);
REG_PORT_OUTSET0 = (1u << 17) | (1u << 19);
REG_PORT_OUTCLR0 = (1u << 5) | (1u << 22);
for (i=0; i<1000000; i++) {
__asm("nop");
}
......
......@@ -5,3 +5,4 @@ transport select swd
# Chip info
set CHIPNAME at91samd51j18
source [find target/atsame5x.cfg]
reset
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment