Commit c2860238 authored by Jake Read's avatar Jake Read

add atsams70

parent 4c56e155
Pipeline #1360 passed with stage
in 4 seconds
File deleted
int main (void)
{
/* Insert system clock initialization code here (sysclk_init()). */
board_init();
sysclk_init();
/* Insert application code here, after the board has been initialized. */
// startup the PIOA peripheral clock - only necessary for Inputs and Interrupts
PMC->PMC_PCER0 = 1 << ID_PIOA;
// Peripheral Enable Register
// Set PER to 1 at the pin to enable the PIO peripheral,
// set PDR (peripheral disable register) to 1 to clear that, opening the pin up for other peripherals (uart, etc)
PIOA->PIO_PER |= PIO_PER_P28 | PIO_PER_P15;
// Output Enable Register
PIOA->PIO_OER = PIO_PER_P28;
// Output Disable Register
PIOA->PIO_ODR = PIO_PER_P15;
// B1 pulls PA15 to GND
while (1) {
// Clear Output Data Register (open drain)
if(PIOA->PIO_PDSR & PIO_PER_P15){
PIOA->PIO_CODR = PIO_PER_P28;
} else {
PIOA->PIO_SODR = PIO_PER_P28;
}
}
}
<html>
<head>
<style>
pre code {
background-color: #eee;
border: 1px solid #999;
display: block;
padding: 20px;
}
</style>
</head>
<body>
<h1>ATSAM4S</h1>
<figure>
<img src='ring.png' height=50%>
<figcaption>Ring oscillator with ATSAMS70</figcaption>
</figure>
<p>This ring oscillator runs on the ATSAMS70 MCU using a homebrew dev-board documented <a href='https://gitlab.cba.mit.edu/jakeread/tinynets/tree/master/embedded'>here</a>. The ATSAMS70 has an ARM Cortex-M7 running with a max speed of 300 MHz. C code for the oscillator is available <a href='atsams70_main.c'>here</a>, or visible below.</p>
<pre>
<code>#include <asf.h>
int main (void)
{
/* Insert system clock initialization code here (sysclk_init()). */
board_init();
sysclk_init();
/* Insert application code here, after the board has been initialized. */
// startup the PIOA peripheral clock - only necessary for Inputs and Interrupts
PMC->PMC_PCER0 = 1 << ID_PIOA;
// Peripheral Enable Register
// Set PER to 1 at the pin to enable the PIO peripheral,
// set PDR (peripheral disable register) to 1 to clear that, opening the pin up for other peripherals (uart, etc)
PIOA->PIO_PER |= PIO_PER_P28 | PIO_PER_P15;
// Output Enable Register
PIOA->PIO_OER = PIO_PER_P28;
// Output Disable Register
PIOA->PIO_ODR = PIO_PER_P15;
// B1 pulls PA15 to GND
while (1) {
// Clear Output Data Register (open drain)
if(PIOA->PIO_PDSR & PIO_PER_P15){
PIOA->PIO_CODR = PIO_PER_P28;
} else {
PIOA->PIO_SODR = PIO_PER_P28;
}
}
}
</code>
</pre>
<p>Oddly, the ring would bounce between 5.7MHz and 3.7MHz - I'm guessing that this is due to the GPIO peripheral occasionally sampling on a 'close' edge of it's 150MHz peripheral clock or on 'the next edge' ... if that makes any sense.</p>
<p><a href='../../index.html'>Back</a></p>
</body>
</html>
\ No newline at end of file
......@@ -63,6 +63,16 @@
}
],
"gpio":[
{
"name":"ATSAMS70",
"serial_number":"",
"subdirectory_path":"gpio/atsams70",
"dev_board_price":15.00,
"dev_board_sales link":"",
"ic_price":9.55,
"ic_sales_link":"",
"ring_period":0.17
},
{
"name":"ATSAM4S",
"serial_number":"",
......
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