Skip to content

Commit

Permalink
Bugfix: Deadlocks due to RPi SPI mutex code
Browse files Browse the repository at this point in the history
- SPI transfern function calls transfernb function so a deadlock was
occurring when a lock was attempted prior to the call
- Thread should be unlocked before returning if bcm2835_init() fails
  • Loading branch information
TMRh20 committed Dec 19, 2015
1 parent 243e25f commit 9a5ea80
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions utility/RPi/spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SPI::SPI() {
void SPI::begin( int busNo ) {
spiNoInterrupts();
if (!bcm2835_init()){
spiInterrupts();
return;
}

Expand Down
2 changes: 0 additions & 2 deletions utility/RPi/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len){

void SPI::transfern(char* buf, uint32_t len)
{
spiNoInterrupts();
transfernb(buf, buf, len);
spiInterrupts();
}
/**
* \endcond
Expand Down

0 comments on commit 9a5ea80

Please sign in to comment.