SPI chip select problem on AT32UC3C0512C

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

Hello, I''m trying to set up simple SPI communication from my AT32UC3C0512C, but when I look with oscilloscope looks like chip select never goes to 0, here is my code:

 

#define CS_CHANNEL 0

#define SPI_INSTANCE &AVR32_SPI1

pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP);

gpio_enable_module_pin(AVR32_SPI1_MOSI_1_PIN, AVR32_SPI1_MOSI_1_FUNCTION);
gpio_enable_module_pin(AVR32_SPI1_MISO_1_PIN, AVR32_SPI1_MISO_1_FUNCTION);
gpio_enable_module_pin(AVR32_SPI1_SCK_1_PIN,  AVR32_SPI1_SCK_1_FUNCTION);
// tried AVR32_SPI1_NPCS_1_PIN/FUNCTION as well, 
// AVR32_SPI1_NPCS_1_0_PIN/FUNCTION also.
gpio_enable_module_pin(AVR32_SPI1_NPCS_0_1_PIN, AVR32_SPI1_NPCS_0_1_FUNCTION);
	
spi_options_t my_spi_options={
    CS_CHANNEL,
    1000000,
    8,
    0,
    0,
    1,
    SPI_MODE_3,
    1
 };
	  
spi_initMaster(SPI_INSTANCE, &my_spi_options);
spi_setupChipReg(SPI_INSTANCE, &my_spi_options, FOSC0);
spi_enable(SPI_INSTANCE);


 spi_selectChip(SPI_INSTANCE, CS_CHANNEL);
 
 spi_put(SPI_INSTANCE, 0x80);
 spi_writeEndCheck(SPI_INSTANCE);
	 
 spi_unselectChip(SPI_INSTANCE, CS_CHANNEL);

I get data at clock and MOSI, but chip select never goes to 0, could anyone help please_

Last Edited: Sat. Sep 2, 2017 - 11:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The post seems out of place here, I'll move it to the UC3 forum.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Are you looking at pin 31 for SPI1 NCPS0 ?