Before I ask a long and complex question about SPI, I'd like to have one last go at figuring this out myself with a nudge in the right direction :)
I'm trying to use the SPI on an AT32UC3L0256 and keeping space and cost down by just using the internal RC CLOCK.
My question is: Is there any reason why I can't use the SPI with just the RC CLOCK?
Is it too slow, is the peripheral clock not enabled etc?
I'm getting no output at all from the SPI pins when looked at on a scope (detail on THAT later if I needed - for now I'm looking in to clock issues).
my conf_clock.h has the following definititions from the defaults.
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RCSYS /* Fbus = Fsys / (2 ^ BUS_div) */ #define CONFIG_SYSCLK_CPU_DIV 0 #define CONFIG_SYSCLK_PBA_DIV 0 #define CONFIG_SYSCLK_PBB_DIV 0 #if UC3L3_L4 //#define CONFIG_USBCLK_SOURCE USBCLK_SRC_OSC0 #define CONFIG_USBCLK_SOURCE USBCLK_SRC_PLL0 /* Fusb = Fsys / USB_div */ #define CONFIG_USBCLK_DIV 1 #define CONFIG_PLL0_SOURCE PLL_SRC_OSC0 /* Fpll0 = (Fclk * PLL_mul) / PLL_div */ #define CONFIG_PLL0_MUL (48000000UL / BOARD_OSC32_HZ) #define CONFIG_PLL0_DIV 1 #endif
My CPU seems to run nicely with a 1hz flashing light as expected with delay_ms() finctions.
I'm also pushing a byte out with spi_write() in that loop ... now, if that has a wait for completion in it, I'd have expected it to hang if my peripheral clocks were messed up, right?
Do I need to do anything special to get the SPI to work (other than all the stuff I've tried from dozens of examples).
The baudrate field in my spiOptions struct that I'm passing to spi_initMaster() is set to 1mhz... does that matter? Is there another internal clock looking after that or will the SPI bus just run proportionately slower due to my slow RC clock?
Supplemental question: Is my only INTERNAL clock option the SYSCLK_SRC_RCSYS (115khz?) or is there a faster internal option without adding a crystal? I recall getting ATMEGA chips to run at a decent rate with just internal clocks.