Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI read ends in deadlock when power if off #150

Open
PSLLSP opened this issue Aug 23, 2020 · 0 comments
Open

SPI read ends in deadlock when power if off #150

PSLLSP opened this issue Aug 23, 2020 · 0 comments
Labels

Comments

@PSLLSP
Copy link

PSLLSP commented Aug 23, 2020

I play with MAX6675K module. I found that when I set power off and than try try to read from SPI, BusPirate ends in deadlock condition.

Configure SPI mode:

HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>5
Set speed:
 1. 30KHz
 2. 125KHz
 3. 250KHz
 4. 1MHz

(1)>4
Clock polarity:
 1. Idle low *default
 2. Idle high

(1)>
Output clock edge:
 1. Idle to active
 2. Active to idle *default

(2)>
Input sample phase:
 1. Middle *default
 2. End

(1)>2
CS:
 1. CS
 2. /CS *default

(2)>
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

(1)>
Clutch disengaged!!!
To finish setup, start up the power supplies with command 'W'

Ready

Activate POWER and Pull UPs resistors (SPI device is powered from +5V, VPU wire is connected to +5V). I can read data (16 bits), no problem:

SPI>W
POWER SUPPLIES ON
Clutch engaged!!!
SPI>P
Pull-up resistors ON
SPI>[rr]
/CS ENABLED
READ: 0x03 
READ: 0xF9 
/CS DISABLED
SPI>[rr]
/CS ENABLED
READ: 0x04 
READ: 0x11 
/CS DISABLED
SPI>[r:2]
/CS ENABLED
READ: 0x04 0x11
/CS DISABLED

Power OFF and try to read data. DEADLOCK, a bug! BusPirate device has to be re-pluged to reset...

SPI>w
Clutch disengaged!!!
POWER SUPPLIES OFF
SPI>[rr]
/CS ENABLED
READ: 

Another, related bug. It seems like BusPirate BASIC cannot activate Power or when it is done then it is activated in some wrong way (LED signaling that power is active is ON, so power was activated in BASIC). The following BASIC program ends in deadlock when it is started and power was not activated with W command in manual mode. Power should be activated at line 10, LED is activated. Deadlock is at line 50, the first RECEIVE statement:

10  PSU 1
20  PULLUP 1
30  DELAY 5
40  START 
50  LET A= RECEIVE 
60  LET B= RECEIVE 
70  LET W=A*256+B
80  STOP 
90  PSU 0
100  PRINT A;",";B;",";W

My BusPirate is cute little box, a clone device from eBay:

HiZ>i
Bus Pirate v3.b clone w/different PIC
Firmware v6.3-beta1 r2151  Bootloader v4.4
DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
http://dangerousprototypes.com
@kallisti5 kallisti5 added the bug label Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants