SPI not working on UC3-A3

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

Hi forum,

 

Working with a colleague trying to set up SPI on the AT32UC3A3256 (with ASF) --- we seem to be running into exactly the same issue as this (rather old) post:

 

http://www.avrfreaks.net/forum/u...

 

We are correctly using gpio_enable_module as mentioned in comment 3 --- other than that, the symptoms match, the results match, we can add the while loop where he says and it hangs as he says.

 

Any ideas/pointers?

 

Thanks,

Cal-linux

--

 

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

Do spi_initMaster() and spi_selectionMode() return SPI_OK (0) ?
Have you configured the 'chip-selects' with appropriate calls to spi_setupChipReg() ?
You will need to do an spi_selectChip() before transmitting data and probably (depending on your configuration), an spi_unselectChip() afterwards.

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

mikech wrote:
Do spi_initMaster() and spi_selectionMode() return SPI_OK (0) ? Have you configured the 'chip-selects' with appropriate calls to spi_setupChipReg() ? You will need to do an spi_selectChip() before transmitting data and probably (depending on your configuration), an spi_unselectChip() afterwards.

 

Thanks mikech --- this actually helped resolve the problem. It turns out spi_setupChipReg() was not returning SPI_OK because the baud rate divider was too large. We were running the UC3 at 84MHz, and trying to run SPI at 100k baud. spi_setupChipReg() enforces the maximum of 8 bits of divider, and 84MHz requires a divisor of 840. Increasing the baud rate to 400k resolved the problem. The SPI pins are now active and producing signals.

 

Thanks,

Cal-linux

--

 

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

Please mark the solution: http://www.avrfreaks.net/comment...