Close

Day 16 - Bringup

A project log for Sailing the 7 Seas -- nautical blinkenlights

Nautically correct blinkenlights that flash just like the real lighthouses and buoys; on a colourful nautical map thanks to JLCPCBs new PCBs

dirk-willem-van-gulikDirk-WIllem van Gulik 12/29/2023 at 21:310 Comments

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.

Discussions