Stuck at "blinky".

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

I have a very basic problem.... 

 

bought a curiosity nano with SAMD21 on it. Trying to do basic stuff with that. 

 

I followed a tutorial to get the chip to send "hello world". I got that to work. 

 

So second project: Get the led to blink as well.

 

So... now I have a program in harmony V3/mplabx that sends the hello string every second. 

 

uint8_t *buf= (unsigned char *) "Hello world.\r\n";
int main ( void )
{
    int t;
    char tbuf[20];
    
    /* Initialize all modules */
    SYS_Initialize ( NULL );
    t=0;
    SERCOM5_USART_Write (buf, strlen ((char*)buf) );
    while ( true )
    {
        /* Maintain state machines of all polled MPLAB Harmony modules. */
        SYS_Tasks ( );
    
        t++;
        sprintf (tbuf, "%d ", t);  
        SERCOM5_USART_Write (tbuf, strlen ((char*)tbuf) );
        delay_ms (10);
        SERCOM5_USART_Write (buf, strlen ((char*)buf) );
        delay_ms(1000);
        port_pin_set_output_level(PIN_PB10, t&1);
    }

    /* Execution should not come here during normal operation */

    return ( EXIT_FAILURE );
}

Then I googled for how to do something with a GPIO pin, and found the port_set_output_level call. Great. 

But the compiler says it doesn't exist. All examples indicate it should just work, the documentation says: 
no prerequesits. great. but... function doesn't exist. 

 

So what do I need to do to make this work ?

 

P.S. if anybody can explain why the 10ms delay between the two writes is necessary that'd be a help too. 

Last Edited: Tue. Jun 1, 2021 - 09:33 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is some led blinking using harmony:

https://microchip-mplab-harmony....
/Lars

 

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

Yeah. Found something like that. Got it to work. Eventually it turns out I can just say LED_Set() to turn the output high. (led off on the curiosity).