Skip to content

Commit

Permalink
0.2.rev.A. Separate VDD read/prog control and Add size selector in so…
Browse files Browse the repository at this point in the history
…ftware
  • Loading branch information
robsonsmartins committed Dec 26, 2023
1 parent 0050e91 commit b47d3c3
Show file tree
Hide file tree
Showing 11 changed files with 491 additions and 201 deletions.
25 changes: 19 additions & 6 deletions software/usbflashprog/backend/devices/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ QString TDeviceID::getManufacturerName(void) const {
case 0x04:
return "Fujitsu";
case 0x0C: // to validate
case 0x29:
return "Microchip Technology";
case 0x1C: // to validate
return "EON";
Expand Down Expand Up @@ -57,6 +58,8 @@ QString TDeviceID::getManufacturerName(void) const {
return "Adesto Technologies";
case 0x89:
return "Intel";
case 0x8F:
return "National Semiconductor";
case 0x9D: // to validate
return "Xicor";
case 0xAD:
Expand Down Expand Up @@ -105,7 +108,8 @@ Device::Device(QObject *parent)
size_(0),
twp_(1),
twc_(1),
vdd_(5.0f),
vddRd_(5.0f),
vddWr_(5.0f),
vpp_(12.0f),
skipFF_(false),
fastProg_(false),
Expand Down Expand Up @@ -165,13 +169,22 @@ uint32_t Device::getTwc() const {
return twc_;
}

void Device::setVdd(float value) {
if (vdd_ == value) return;
if (value >= 0.0f) vdd_ = value;
void Device::setVddRd(float value) {
if (vddRd_ == value) return;
if (value >= 0.0f) vddRd_ = value;
}

float Device::getVdd() const {
return vdd_;
float Device::getVddRd() const {
return vddRd_;
}

void Device::setVddWr(float value) {
if (vddWr_ == value) return;
if (value >= 0.0f) vddWr_ = value;
}

float Device::getVddWr() const {
return vddWr_;
}

void Device::setVpp(float value) {
Expand Down
24 changes: 18 additions & 6 deletions software/usbflashprog/backend/devices/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,25 @@ class Device : public QObject {
*/
virtual uint32_t getTwc() const;
/**
* @brief Sets the VDD.
* @brief Sets the VDD to Read.
* @param value VDD value, in volts.
*/
virtual void setVdd(float value);
virtual void setVddRd(float value);
/**
* @brief Returns the configured VDD (in volts).
* @brief Returns the configured VDD to Read (in volts).
* @return VDD value, in volts.
*/
virtual float getVdd() const;
virtual float getVddRd() const;
/**
* @brief Sets the VDD to Program.
* @param value VDD value, in volts.
*/
virtual void setVddWr(float value);
/**
* @brief Returns the configured VDD to Program (in volts).
* @return VDD value, in volts.
*/
virtual float getVddWr() const;
/**
* @brief Sets the VPP.
* @param value VPP value, in volts.
Expand Down Expand Up @@ -299,8 +309,10 @@ class Device : public QObject {
uint32_t twp_;
/* @brief tWC, in microseconds. */
uint32_t twc_;
/* @brief VDD, in volts. */
float vdd_;
/* @brief VDD to Read, in volts. */
float vddRd_;
/* @brief VDD to Program, in volts. */
float vddWr_;
/* @brief VPP, in volts. */
float vpp_;
/* @brief Enables skip prog 0xFF. */
Expand Down
3 changes: 2 additions & 1 deletion software/usbflashprog/backend/devices/parallel/dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Dummy::Dummy(QObject *parent) : Device(parent), protected_(true) {
info_.capability.hasVPP = true;
twp_ = 1000;
twc_ = 2000;
vdd_ = 5.0f;
vddRd_ = 5.0f;
vddWr_ = 5.0f;
vpp_ = 12.0f;
setSize(2048);
}
Expand Down
15 changes: 11 additions & 4 deletions software/usbflashprog/backend/devices/parallel/m27xxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@

// ---------------------------------------------------------------------------

M27xxx::M27xxx(QObject *parent) : SRAM(parent) {
M27xxx::M27xxx(QObject *parent)
: SRAM(parent), progWithWE_(true), progIsInverted_(false) {
info_.deviceType = kDeviceParallelMemory;
info_.name = "EPROM 27xxx";
info_.capability.hasRead = true;
info_.capability.hasProgram = true;
info_.capability.hasVerify = true;
info_.capability.hasBlankCheck = true;
info_.capability.hasGetId = true;
info_.capability.hasVDD = true;
info_.capability.hasVPP = true;
skipFF_ = true;
twp_ = 3;
twc_ = 5;
vdd_ = 5.0f;
twp_ = 600;
twc_ = 8;
vddRd_ = 5.0f;
vddWr_ = 6.0f;
vpp_ = 13.0f;
size_ = 2048;
}
Expand All @@ -53,3 +56,7 @@ bool M27xxx::verify(const QByteArray &buffer) {
bool M27xxx::blankCheck() {
return false;
}

bool M27xxx::getId(TDeviceID &result) {
return false;
}
6 changes: 6 additions & 0 deletions software/usbflashprog/backend/devices/parallel/m27xxx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class M27xxx : public SRAM {
virtual bool verify(const QByteArray &buffer);
/* Reimplemented */
virtual bool blankCheck();
/* Reimplemented */
virtual bool getId(TDeviceID &result);

protected:
bool progWithWE_; // true use WE / false use CE
bool progIsInverted_; // true invert prog pin (positive pulse)
};

#endif // BACKEND_DEVICES_PARALLEL_M27XXX_HPP_
4 changes: 2 additions & 2 deletions software/usbflashprog/backend/devices/parallel/sram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SRAM::SRAM(QObject *parent) : Device(parent) {
info_.capability.hasVDD = true;
twp_ = 3;
twc_ = 5;
vdd_ = 5.0f;
vddRd_ = 5.0f;
size_ = 2048;
}

Expand All @@ -43,7 +43,7 @@ bool SRAM::program(const QByteArray &buffer, bool verify) {
if (runner_.open(port_)) {
error = false;
resetBus_();
runner_.vddSet(vdd_);
runner_.vddSet(vddRd_);
runner_.vddCtrl();
runner_.setCE();
runner_.usDelay(30); // 30 uS
Expand Down
16 changes: 10 additions & 6 deletions software/usbflashprog/i18n/ufprog_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,21 @@
<source>Press to change unit</source>
<translation>Press to change unit</translation>
</message>
<message>
<source>Adjust VDD [Caution!]</source>
<translation>Adjust VDD [Caution!]</translation>
</message>
<message>
<source>Adjust VPP [Caution!]</source>
<translation>Adjust VPP [Caution!]</translation>
</message>
<message>
<source>Fast Mode</source>
<translation>Fast Mode</translation>
<source>Adjust VDD to Read [Caution!]</source>
<translation>Adjust VDD to Read [Caution!]</translation>
</message>
<message>
<source>Adjust VDD to Program [Caution!]</source>
<translation>Adjust VDD to Program [Caution!]</translation>
</message>
<message>
<source>Fast Program/Erase Mode</source>
<translation>Fast Program/Erase Mode</translation>
</message>
</context>
</TS>
18 changes: 11 additions & 7 deletions software/usbflashprog/i18n/ufprog_pt_BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,23 +487,27 @@
</message>
<message>
<source>0 - Byte Programming</source>
<translation>0 - Gravação por Byte</translation>
<translation>0 - Programação por Byte</translation>
</message>
<message>
<source>Press to change unit</source>
<translation>Aperte para alterar a unidade</translation>
</message>
<message>
<source>Adjust VDD [Caution!]</source>
<translation>Ajuste de VDD [Cuidado!]</translation>
</message>
<message>
<source>Adjust VPP [Caution!]</source>
<translation>Ajuste de VPP [Cuidado!]</translation>
</message>
<message>
<source>Fast Mode</source>
<translation>Modo Rápido</translation>
<source>Adjust VDD to Read [Caution!]</source>
<translation>Ajuste de VDD para Leitura [Cuidado!]</translation>
</message>
<message>
<source>Adjust VDD to Program [Caution!]</source>
<translation>Ajuste de VDD para Programação [Cuidado!]</translation>
</message>
<message>
<source>Fast Program/Erase Mode</source>
<translation>Modo de Programação/Apagamento Rápido</translation>
</message>
</context>
</TS>
Loading

0 comments on commit b47d3c3

Please sign in to comment.