Hello, I'm trying to use Atmel Start to get started with a SAME51 board I've designed. I am trying to use the FreeRTOS drivers bundled in Atmel START, and after a productive first day, I've hit a series of roadblocks:
Initially, I found plenty of references on this forum to the lack of validation in the clock generators for START. Using my debugger, I was able to get the SAME51 to run at 120MHz with XOSC1, and get (hopefully) the 6 other clocks configured. Then, I was able to control GPIO and the SPI RTOS driver, getting my first set of hardware interfaces brought up correctly.
Next, I moved on to the UART RTOS driver, where my luck was not so good. I ran into a problem where (according to my j-link debugger), I was getting nonsensical results. The UART descriptor is being instantiated at 0x20001A90, but when I try to get the io descriptor, it gets an incorrect value.
struct io_descriptor *io; struct io_descriptor *io2; usart_os_get_io(&UART, &io); *io2 = (void*)&UART; ASSERT(io == io2); // this is true ASSERT(io == 0x20001A90); // this is false, it's getting 0x20000D7C which is 3348 bytes off!
After I tried hardcoding the address into the io, I was able to get a few bytes transmitted, but then I found that somewhere in the UART driver, it was taking an extra reference but casting it incorrectly, so the sem_up/sem_down commands in the UART module resulted in crashes. I tried fixing these, and got an entire command to send, but then it would crash later when the sem_up/sem_down argument was correctly referenced. This makes me worry that using the GCC compiler from microchip's website is getting me into compiler bug territory.
I tried moving on to the ADC, where I just used the example code from examples.c, and that also results in a crash. I haven't been able to debug what's going on with this crash, because I see the ADC convert task runs fine, and the ADC read task makes it into adc_os_read_channel, but again I get a crash sometime after the ringbuffer critical section when it tries to return from the sem_down.
I still need to bring up the CCL, PTC, CAN bus, and an I2C sercom in addition to the ADC & UART that haven't been working. I suspect that I'm doing something fundamentally wrong (trying to use ASF at all? or using the RTOS drivers?). Is any of the ASF code tested to work? Should I be using the async or dma drivers? Should I chuck the lot of it, and start over with another approach?
I would really appreciate your advice on how to write software for a complex SAME51 application, because this board has a lot of parts, and I feel like this approach isn't going to result in any progress.
edited to add: I did most of this work with GCC 6.3.1 that I found on microchip's site for mac. I also tried GCC 10.2.1, but that didn't help.