SPI Write Collision

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderators: utzig, tfAteba

Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

SPI Write Collision

Postby Marco » Mon Oct 17, 2016 11:33 am

Hi,

I found a bug in the AVR SPI driver.

When doing multiple multi-byte SPI write operations, the Write Collision Flag (WCOL) bit in SPI Status Register (SPSR) gets set.
This is caused by calling

Code: Select all

_spi_isr_code(spip);
while the transmission is still in progress.

Attached is a patch to fix this issue.

Marco
Attachments
hal_spi_lld_patch.zip
SPI Write Collision fix
(635 Bytes) Downloaded 77 times

utzig
Posts: 355
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 19 times
Contact:

Re: SPI Write Collision

Postby utzig » Mon Oct 17, 2016 11:54 am

That patch doesn't seem to have been created against trunk. What version are you using?

Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: SPI Write Collision

Postby Marco » Mon Oct 17, 2016 12:13 pm

No i'm sorry. I'm using the git mirror at commit 11eb96e. (svn://svn.code.sf.net/p/chibios/svn/trunk@9759).

Attached is the patch created against trunk.
Attachments
hal_spi_lld.c.patch.zip
SPI Write Collision fix
(575 Bytes) Downloaded 69 times

utzig
Posts: 355
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 19 times
Contact:

Re: SPI Write Collision

Postby utzig » Mon Oct 17, 2016 12:18 pm

Both patches apply the same changes.

Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: SPI Write Collision

Postby Marco » Mon Oct 17, 2016 12:25 pm

Yes, i just recreated the patch with TortoiseSVN on the SVN trunk. The changes are the same.

utzig
Posts: 355
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 19 times
Contact:

Re: SPI Write Collision

Postby utzig » Mon Oct 17, 2016 1:02 pm

The problem seemed to arrive from using patch on Mac OS X with CRLF line endings...

Applied, thanks!


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 1 guest