Beispiel #1
0
extern "C" void init( void )
{
	SystemInit();

	// Set Systick to 1ms interval, common to all SAM3 variants
	if (SysTick_Config(SystemCoreClock / 1000))
	{
		// Capture error
		while (true);
	}

	UrgentInit();			// initialise anything in the main application that can't wait

	// Initialize C library
	__libc_init_array();

	// Initialize Serial port U(S)ART pins
	ConfigurePin(g_APinDescription[APINS_USART0]);
	setPullup(APIN_USART0_RXD, true); 							// Enable pullup for RXD

	// Initialize USB pins
	ConfigurePin(g_APinDescription[APINS_USB]);

	// Initialize Analog Controller
	AnalogInInit();

	// Initialize analogOutput module
	AnalogOutInit();

	// Initialize TRNG
	pmc_enable_periph_clk(ID_TRNG);
	TRNG->TRNG_IDR = TRNG_IDR_DATRDY;							// Disable all interrupts
	TRNG->TRNG_CR = TRNG_CR_KEY(0x524e47) | TRNG_CR_ENABLE;		// Enable TRNG with security key (required)
}
Beispiel #2
0
extern "C" void init( void )
{
	SystemInit();

	// Set Systick to 1ms interval, common to all SAM3 variants
	if (SysTick_Config(SystemCoreClock / 1000))
	{
		// Capture error
		while (true);
	}

	// Initialize C library
	__libc_init_array();

	// Disable pull-up on every pin
	for (size_t i = 0; i <= MaxPinNumber; i++)
	{
		setPullup(i, false);
	}

	// Enable parallel access on PIO output data registers
//	PIOA->PIO_OWER = 0xFFFFFFFF;
//	PIOB->PIO_OWER = 0xFFFFFFFF;
//	PIOC->PIO_OWER = 0xFFFFFFFF;
//	PIOD->PIO_OWER = 0xFFFFFFFF;

	// Initialize Serial port U(S)ART pins
	ConfigurePin(g_APinDescription[APINS_UART]);
	setPullup(APIN_UART_RXD, true); 							// Enable pullup for RX0
	ConfigurePin(g_APinDescription[APINS_USART0]);

	// Initialize USB pins
	ConfigurePin(g_APinDescription[APINS_USB]);

	// Initialize Analog Controller
	AnalogInInit();

	// Initialize analogOutput module
	AnalogOutInit();

	// Initialize HSMCI pins
	ConfigurePin(g_APinDescription[APIN_HSMCI_CLOCK]);
	ConfigurePin(g_APinDescription[APINS_HSMCI_DATA]);

	// Initialize Ethernet pins
	ConfigurePin(g_APinDescription[APINS_EMAC]);

	// Initialize TRNG
	pmc_enable_periph_clk(ID_TRNG);
	TRNG->TRNG_IDR = TRNG_IDR_DATRDY;							// Disable all interrupts
	TRNG->TRNG_CR = TRNG_CR_KEY(0x524e47) | TRNG_CR_ENABLE;		// Enable TRNG with security key (required)

	// Start the USB
	udc_start();
}
Beispiel #3
0
extern "C" void init( void )
{
	SystemInit();

	// Set Systick to 1ms interval, common to all SAM3 variants
	if (SysTick_Config(SystemCoreClock / 1000))
	{
		// Capture error
		while (true);
	}

	UrgentInit();			// initialise anything in the main application that can't wait

	// Initialize C library (I think this calls C++ constructors for static data too)
	__libc_init_array();

	// We no longer disable pullups on all pins here, better to leave them enabled until the port is initialised

	// Initialize Serial port U(S)ART pins
	ConfigurePin(g_APinDescription[APINS_UART0]);
	setPullup(APIN_UART0_RXD, true); 							// Enable pullup for RX0
	ConfigurePin(g_APinDescription[APINS_UART1]);
	setPullup(APIN_UART1_RXD, true); 							// Enable pullup for RX1

	// No need to initialize the USB pins on the SAM4E because they are USB by default

	// Initialize Analog Controller
	AnalogInInit();

	// Initialize analogOutput module
	AnalogOutInit();

	// Initialize HSMCI pins
	ConfigurePin(g_APinDescription[APIN_HSMCI_CLOCK]);
	ConfigurePin(g_APinDescription[APINS_HSMCI_DATA]);

	// Start the USB
	udc_start();
}