SAME70 xplained break in loop issue

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I hope I am posting this in the correct area.  I am using the SAME70 xplained board and started a simple project to flash the onboard LED as well as send a byte out of the UART in an infinate loop.  For some reason, the loop seems to break and stop in the middle of running.  Has anyone had any issues like this? I assume it's somthing stupid I am over looking.
Thanks for any help.

#include <asf.h>
#include <board.h>
#include <conf_board.h>

void board_init(void)
{
ioport_init();
#define ioport_set_port_peripheral_mode(port, masks, mode) \
	do {\
		ioport_set_port_mode(port, masks, mode);\
		ioport_disable_port(port, masks);\
	} while (0)


#define ioport_set_pin_peripheral_mode(pin, mode) \
	do {\
		ioport_set_pin_mode(pin, mode);\
		ioport_disable_pin(pin);\
	} while (0)



	#ifdef CONF_BOARD_UART_CONSOLE
	/* Configure UART pins */
	ioport_set_pin_peripheral_mode(USART0_RXD_GPIO, USART0_RXD_FLAGS);
	MATRIX->CCFG_SYSIO |= CCFG_SYSIO_SYSIO4;
	ioport_set_pin_peripheral_mode(USART0_TXD_GPIO, USART0_TXD_FLAGS);
	#endif
	
	ioport_set_pin_dir(LED0, IOPORT_DIR_OUTPUT);
	ioport_set_pin_level(LED0, IOPORT_PIN_LEVEL_HIGH);
	ioport_set_pin_mode(LED0, IOPORT_MODE_PULLDOWN);

}
#ifndef CONF_BOARD_H
#define CONF_BOARD_H


/** Board oscillator settings */
#define BOARD_FREQ_SLCK_XTAL            (32768U)
#define BOARD_FREQ_SLCK_BYPASS          (32768U)
#define BOARD_FREQ_MAINCK_XTAL          (12000000U)
#define BOARD_FREQ_MAINCK_BYPASS        (12000000U)

/** Master clock frequency */
#define BOARD_MCK                       CHIP_FREQ_CPU_MAX

/** board main clock xtal statup time */
#define BOARD_OSC_STARTUP_US            15625

#define LED0            PIO_PC8_IDX


#define CONF_BOARD_UART_CONSOLE

/** USART0 pins definitions, PB0,PB1. */
#define USART0_RXD_GPIO   PIO_PB0_IDX
#define USART0_RXD_FLAGS  IOPORT_MODE_MUX_C // Peripheral C for RXD0
#define USART0_TXD_GPIO   PIO_PB1_IDX
#define USART0_TXD_FLAGS  IOPORT_MODE_MUX_C // Peripheral C for TXD0


#endif // CONF_BOARD_H
#include "asf.h"
#include "stdio_serial.h"
#include "conf_board.h"
#include "conf_clock.h"

int main (void)
{
    
/* Insert system clock initialization code here (sysclk_init()). */
    sysclk_init();
    board_init();

//  Configure UART console.
const sam_usart_opt_t usart_console_settings = {
    USART_SERIAL_BAUDRATE,
    USART_SERIAL_CHAR_LENGTH,
    USART_SERIAL_PARITY,
    USART_SERIAL_STOP_BIT,
    US_MR_CHMODE_NORMAL
};

    sysclk_enable_peripheral_clock(USART_SERIAL_ID);
    
    usart_init_rs232(USART_SERIAL, &usart_console_settings,
    sysclk_get_main_hz());
    usart_enable_tx(USART_SERIAL);
    usart_enable_rx(USART_SERIAL);
    
    while(1)
    {
        
        delay_ms(200);
        ioport_set_pin_level(LED0, IOPORT_PIN_LEVEL_LOW);
        delay_ms(200);
        ioport_set_pin_level(LED0, IOPORT_PIN_LEVEL_HIGH);
        
        usart_putchar(USART_SERIAL, 0x55);
        
            
    }

    
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

watchdog timer?

 

    /* Disable watchdog */
    WDT_Disable(WDT);

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you using SAM E70 Xplained dev board?

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I have not been able to try the watchdog disable yet.

Thanks for the reply

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did it work?

Silly beans are always silly
:)