Skip to content

Commit

Permalink
Fix:incorrect reading of the DataFlash status register
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbigmdm committed Sep 16, 2024
1 parent 083d42b commit b5f3982
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
22 changes: 21 additions & 1 deletion IMSProg_programmer/dialogsr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ void DialogSR::on_pushButton_read_clicked()
if (stCH341 == 0)
{
SPI_CONTROLLER_Chip_Select_Low();
SPI_CONTROLLER_Write_One_Byte(0x05);
if (currentChipType != 5) SPI_CONTROLLER_Write_One_Byte(0x05);
else SPI_CONTROLLER_Write_One_Byte(0xd7);
retval = SPI_CONTROLLER_Read_NByte(buf,1,SPI_CONTROLLER_SPEED_SINGLE);
qDebug() << "retval=" << retval;
SPI_CONTROLLER_Chip_Select_High();
Expand Down Expand Up @@ -133,18 +134,37 @@ void DialogSR::setChipType(const uint chipType)
case 3:
ui->label_20->setText("/RDY");
ui->label_19->setText("WEN");
ui->label_18->setText("BP0");
ui->label_17->setText("BP1");
ui->label_13->setText("WPEN");
ui->label_14->setText("X");
ui->pushButton_write->setEnabled(true);
break;

case 4:
ui->label_20->setText("WIP");
ui->label_19->setText("WEL");
ui->label_18->setText("BP0");
ui->label_17->setText("BP1");
ui->label_13->setText("SRWD");
ui->label_14->setText("X");
ui->pushButton_write->setEnabled(true);
break;

case 5:
ui->label_20->setText("PAGE");
ui->label_19->setText("WP");
ui->label_18->setText("X");
ui->label_17->setText("X");
ui->label_13->setText("RDY");
ui->label_14->setText("COMP");
ui->pushButton_write->setEnabled(false);
break;

default:
break;
}
currentChipType = chipType;
}

void DialogSR::closeEvent(QCloseEvent* event)
Expand Down
1 change: 1 addition & 0 deletions IMSProg_programmer/dialogsr.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class DialogSR : public QDialog
explicit DialogSR(QWidget *parent = nullptr);
void setChipType(const uint chipType);
void closeEvent(QCloseEvent* event);
uint currentChipType;
~DialogSR();

private slots:
Expand Down
6 changes: 5 additions & 1 deletion IMSProg_programmer/dialogsr.ui
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,11 @@ background-color: rgb(120, 183, 140);
border-radius: 20px;
border: 2px solid #094065;border-radius:8px;font-weight:600;
}
QPushButton::pressed{background-color: rgb(115, 210, 22);}</string>
QPushButton::pressed{background-color: rgb(115, 210, 22);}
QPushButton:!enabled
{
background-color:#ccc;
}</string>
</property>
<property name="text">
<string>Write</string>
Expand Down

0 comments on commit b5f3982

Please sign in to comment.