SPI Write Collision

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

Moderator: tfAteba

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

SPI Write Collision

Post by Marco »

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 529 times
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: SPI Write Collision

Post by utzig »

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

Post by Marco »

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 594 times
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: SPI Write Collision

Post by utzig »

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

Post by Marco »

Yes, i just recreated the patch with TortoiseSVN on the SVN trunk. The changes are the same.
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: SPI Write Collision

Post by utzig »

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

Applied, thanks!
Post Reply