I've just started out into the 32 bit world, with a UC3-A3 XPLAINED Board, and the ASF.

I'm trying (in vain!) to get the SPI interface up and running, and I *think* I'm stuck at a clock set-up issue.

I've been following the layout for the ASF with regard to getting the SPI up and running, with input from the past topics in this forum.

The code compiles, but where I could have sworn I was once stepping through the main loop repeatedly, now appears to hang on "while(!spi_is_tx_empty(SPI1));",

Having started out with a logic analyzer on the header for SPI1, and now an Oscillocope, I can not observe /any/ activity on the SPI-related pins; the SCK line remains constantly high.

If I comment out the line of code "SPI1_init()", the SCK line remains low. This makes me think my pin mapping in "SPI1_setup()" is correct, (and I've traced it through the defines, which also make me think it's correct...), and leads me on to clocks.

My main suspiscion is a badly configured clock source, though the PBA div is set to 2 (ie,2^1), and this is in turn referenced by the function "spi_setupChipReg()"... I've attached the relevant code listings below, please let me know if I'm missing anything that would aid in diagnosis!

3)pcl_switch_to_osc(PCL_OSC0,FOSC0,OSC0_STARTUP); to move off the slow osciallator and onto the 12MHz xtal...

4) sysclk_enable_peripheral_clock(SPI1) - this is what I thought I was missing previously, it hasn't helped.

5) Init the SPI1 - as per SPIn_init() in the attached code, options struct detailed there also.

6) Loop - spi_write(SPI,0x80), with wait on is_tx_ready, and is_tx_empty. Loops repeatedly every 500ms, with the LED toggle.

Observed Behaviour; The program seems to run, that is, the LED toggles, and the loop repeats itself. Using breakpoints, I can sequentially, repeatedly step through each line. However, there is no observed electrical activity on any of the corresponding pins.

It's also worth noting that if I use while(!spi_is_tx_empty(SPI1)){;}, the code does actually hang there if a breakpoint is set, and will never continue.