Next up is bringing up the board.
This was done in several steps; first one board was readied with just the CPU, power conditioning, the power LED and the 'ACT" debugging LED. But without the LED driver or any of the LEDs.
For this a simple programme was written:
// Test LED "2" -- R124 needs to be in place or jumpered
//
#define LED_PORT PC
#define LED_PIN PIN4
int main(void)
{
/* Set clock to full speed (16 Mhz) */
CLK_CKDIVR = 0;
/* GPIO setup */
// Set pin data direction as output
PORT(LED_PORT, DDR) |= LED_PIN; // i.e. PB_DDR |= (1 << 5);
// Set pin as "Push-pull"
PORT(LED_PORT, CR1) |= LED_PIN; // i.e. PB_CR1 |= (1 << 5);
while(1) {
// LED on
PORT(LED_PORT, ODR) |= LED_PIN; // PB_ODR |= (1 << 5);
delay(100000L);
// LED off
PORT(LED_PORT, ODR) &= ~LED_PIN; // PB_ODR &= ~(1 << 5);
delay(300000L);
}
}
The full code can be found on GitHub.
Dirk-WIllem van Gulik
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.