Sharing Devices on SPI bus (SERCOM0) causing crashes and faults

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

Greetings,

 

I have an ATMEL SAMD21G chip I am running a SPI bus (SERCOM0) that interfaces to two different devices. The first is a Graphical Display 62684-502100ALF (320 x 240) display. The second is a piece of SPI external flash using the AT25dfx driver. When just the LCD is enabled things work fine. However as soon as I enable the SPI flash things go horribly wrong. I am getting several crashes and am trying to turn off/on devices to allow sharing but I am still getting weird crashes and faults. It blows up in about 5 seconds like clock work and stops at several points in the code. The worst one being the "Dummy_Handler" which I troubleshot to reveal a "Hard Fault"

Here are the screen shots of the stops 

 

 

 

And then it stops here I believe because it reset and the watchdog is syncing 

 

 

Here is another stop 

And another random stop

And finally this one.

 

 

I have no idea how to debug this and figure out what the conflict is. Does anyone know where to start this?

 

Here is a call stack I have which points to the spi bus

 

> InductiveCooker_UI.elf! Dummy_Handler Line: 285

  InductiveCooker_UI.elf! <signal handler called> Line: 285

  InductiveCooker_UI.elf! spi_read_buffer_wait (struct spi_module * const module, uint8_t * rx_data, uint8_t * rx_data@entry, uint16_t length, uint16_t length@entry, uint16_t dummy, uint16_t dummy@entry) Line: 719

  InductiveCooker_UI.elf! _at25dfx_chip_issue_read_command_wait (struct at25dfx_command cmd, struct at25dfx_chip_module * chip) Line: 97

  InductiveCooker_UI.elf! at25dfx_chip_read_buffer (struct at25dfx_chip_module * chip, struct at25dfx_chip_module * chip@entry, at25dfx_address_t address, void * data, void * data@entry, at25dfx_datalen_t length) Line: 333

  InductiveCooker_UI.elf! ExFlash_At25dfx_Read_Buffer (at25dfx_address_t rAddress, const void * data, const void * data@entry, at25dfx_datalen_t length) Line: 316

  InductiveCooker_UI.elf! decodeImageLineInto (unsigned short imageIndex, int atX, int atY, int fromX, int toX, int lineY) Line: 501

  InductiveCooker_UI.elf! ?? Line: 501

 

 

Thanks 

 

Bill

 

 

 

 

Last Edited: Fri. Oct 27, 2017 - 03:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not sure why you posted a Cortex question in a UC3 section of this site (so as Moderator I will move it) but the whole point of SPI is that as long as you work the chip/slave select signals correctly so that at any time only one device is selected then the other devices should tri-state and not interfere with the communication. I assume you doing this (controlling SS/CS) in the above?

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

Thanks I did not know that community existed. Could that interference cause a Hard Fault?