Cov txheej txheem:

MTP Arduino Txoj Haujlwm Piv Txwv: 5 Kauj Ruam
MTP Arduino Txoj Haujlwm Piv Txwv: 5 Kauj Ruam

Video: MTP Arduino Txoj Haujlwm Piv Txwv: 5 Kauj Ruam

Video: MTP Arduino Txoj Haujlwm Piv Txwv: 5 Kauj Ruam
Video: Add USB To Your Electronics Projects! - The USB Protocol Explained 2024, Hlis ntuj nqeg
Anonim
MTP Arduino Qhov Piv Txwv Piv Txwv
MTP Arduino Qhov Piv Txwv Piv Txwv

Hauv Cov Lus Qhia no, peb qhia siv SLG46824/6 Arduino cov txheej txheem kos duab los ua haujlwm Dialog SLG46824/6 GreenPAK ™ Ntau Lub Sijhawm Programmable (MTP) ntaus ntawv.

Feem ntau GreenPAK cov cuab yeej yog Ib Lub Sijhawm Ua Haujlwm (OTP), lub ntsiab lus tias ib zaug lawv Tsis-Volatile Memory bank (NVM) tau sau, nws tsis tuaj yeem sau dua. GreenPAKs nrog MTP tus yam ntxwv, zoo li SLG46824 thiab SLG46826, muaj ntau hom NVM nco txhab nyiaj uas tuaj yeem ua haujlwm ntau dua ib zaug.

Peb tau sau ib daim duab Arduino uas tso cai rau tus neeg siv los teeb tsa MTP GreenPAK nrog qee qhov yooj yim saib xyuas cov lus txib. Hauv Cov Lus Qhia no peb siv SLG46826 ua peb GreenPAK nrog MTP.

Peb muab cov qauv piv txwv rau Arduino Uno siv lub platform qhib qhov chaw raws li C/C ++. Cov neeg tsim qauv yuav tsum tshaj tawm cov txheej txheem siv hauv Arduino code rau lawv lub platform tshwj xeeb.

Txog cov ntaub ntawv tshwj xeeb hais txog I2C cov lus qhia tshwj xeeb, I2C chaw nyob, thiab chaw nco, thov siv GreenPAK In-System Programming Guide qhia hauv SLG46826 cov khoom nplooj ntawv. Cov Lus Qhia no muab kev siv yooj yim ntawm cov phiaj xwm kev qhia no.

Hauv qab no peb piav qhia cov kauj ruam xav tau nkag siab tias GreenPAK nti tau ua haujlwm li cas. Txawm li cas los xij, yog tias koj tsuas yog xav kom tau txais txiaj ntsig los ntawm kev ua haujlwm, rub tawm GreenPAK software los saib qhov ua tiav GreenPAK Tsim Cov Ntaub Ntawv. Txuas GreenPAK Kev Txhim Kho Khoom Siv rau koj lub khoos phis tawj thiab ntaus qhov program los tsim cov cai IC.

Kauj Ruam 1: Kev Sib Txuas Arduino-GreenPAK

Arduino-GreenPAK Kev Sib Txuas
Arduino-GreenPAK Kev Sib Txuas
Arduino-GreenPAK Kev Sib Txuas
Arduino-GreenPAK Kev Sib Txuas

Txhawm rau ua haujlwm NVM ntawm peb SLG46826 GreenPAK nrog peb daim duab Arduino, peb yuav xub xub txuas plaub plaub Arduino Uno pins rau peb GreenPAK. Koj tuaj yeem txuas cov pins ncaj qha mus rau GreenPAK Qhov (Socket Adapter) lossis txuas rau lub rooj sib tham nrog GreenPAK soldered.

Thov nco ntsoov tias sab nraud I2C rub tawm tus tiv thaiv tsis pom hauv daim duab 1. Thov txuas lub 4.7 kΩ rub tawm tus tiv thaiv los ntawm ob qho SCL thiab SDA mus rau Arduino qhov 3.3 V cov zis.

Kauj Ruam 2: Xa GreenPAK NVM Cov Ntaub Ntawv Los Ntawm GreenPAK Tsim Cov Ntaub Ntawv

Exporting GreenPAK NVM Cov Ntaub Ntawv Los ntawm GreenPAK Tsim Cov Ntaub Ntawv
Exporting GreenPAK NVM Cov Ntaub Ntawv Los ntawm GreenPAK Tsim Cov Ntaub Ntawv
Exporting GreenPAK NVM Cov Ntaub Ntawv Los ntawm GreenPAK Tsim Cov Ntaub Ntawv
Exporting GreenPAK NVM Cov Ntaub Ntawv Los ntawm GreenPAK Tsim Cov Ntaub Ntawv
Exporting GreenPAK NVM Cov Ntaub Ntawv Los ntawm GreenPAK Tsim Cov Ntaub Ntawv
Exporting GreenPAK NVM Cov Ntaub Ntawv Los ntawm GreenPAK Tsim Cov Ntaub Ntawv

Peb yuav muab tso ua ke yooj yim heev GreenPAK tsim los qhia txog kev xa tawm NVM cov ntaub ntawv. Kev tsim qauv hauv qab no yog qib hloov pauv yooj yim qhov twg cov pins xiav nyob rau sab laug raug khi rau VDD (3.3v), thaum cov pins daj ntawm sab xis yog khi rau VDD2 (1.8v).

Txhawm rau xa cov ntaub ntawv los ntawm cov qauv no, koj yuav tsum xaiv Cov Ntaub Ntawv → Export → Export NVM, raws li qhia hauv daim duab 3.

Tom qab ntawd koj yuav tsum xaiv Intel HEX Files (*.hex) ua hom ntawv thiab khaws cov ntawv.

Tam sim no, koj yuav tsum qhib lub.hex cov ntaub ntawv nrog cov ntawv sau (zoo li Notepad ++). Txhawm rau kawm paub ntau ntxiv txog Intel's HEX cov ntaub ntawv hom ntawv thiab cov syntax, txheeb xyuas nws nplooj Wikipedia. Txog rau daim ntawv thov no peb tsuas yog txaus siab rau cov ntaub ntawv feem ntawm cov ntaub ntawv raws li qhia hauv daim duab 5.

Ua kom pom tseeb thiab luam tawm 256 bytes ntawm NVM cov ntaub ntawv teeb tsa nyob hauv HEX cov ntaub ntawv. Txhua kab uas peb tab tom theej yog 32 tus ntawv ntev, uas sib raug rau 16 bytes.

Muab cov ntaub ntawv tso rau hauv qhov tseem ceeb nvmString ntu ntawm Arduino kos duab raws li qhia hauv daim duab 6. Yog tias koj siv cov tsis-Arduino Microcontroller, koj tuaj yeem sau ua haujlwm txhawm rau txheeb xyuas nvmData khaws tseg hauv GreenPAK. GP6 cov ntaub ntawv. (Yog tias koj qhib GreenPAK cov ntaub ntawv nrog cov ntawv sau, koj yuav pom tias peb khaws cov ntaub ntawv phiaj xwm hauv XML hom ntawv yooj yim.)

Txhawm rau teeb tsa EEPROM cov ntaub ntawv rau koj GreenPAK tsim, xaiv EEPROM thaiv los ntawm cov khoom vaj huam sib luag, qhib nws cov khoom vaj huam sib luag, thiab nyem "Teeb Cov Ntaub Ntawv."

Tam sim no koj tuaj yeem hloov kho txhua byte hauv EEPROM ib tus zuj zus nrog peb GUI interface.

Thaum koj cov ntaub ntawv EEPROM raug teeb tsa, koj tuaj yeem xa nws mus rau HEX cov ntaub ntawv siv tib txoj kev piav qhia yav dhau los rau xa tawm NVM cov ntaub ntawv. Ntxig cov 256 bytes ntawm EEPROM cov ntaub ntawv rau hauv eepromString ntu ntawm Arduino kos duab.

Rau txhua qhov kev tsim qauv, nws yog ib qho tseem ceeb los tshuaj xyuas qhov chaw tiv thaiv hauv "Security" tab ntawm qhov haujlwm teeb tsa. Cov ntawv no teeb tsa kev tiv thaiv me ntsis rau kev teeb tsa cov lej sau npe, NVM, thiab EEPROM. Hauv qee qhov kev teeb tsa, xa NVM cov ntu tuaj yeem kaw SLG46824/6 rau nws cov teeb tsa tam sim no thiab tshem tawm MTP kev ua haujlwm ntawm lub nti.

Kauj Ruam 3: Siv Arduino Sketch

Siv Arduino Sketch
Siv Arduino Sketch

Tshaj tawm cov duab kos rau koj Arduino thiab qhib qhov ntsuas nrog 115200 baud tus nqi. Tam sim no koj tuaj yeem siv cov duab kos MENU cov lus qhia kom ua ob peb lus txib:

● Nyeem - nyeem ob lub cuab yeej NVM cov ntaub ntawv lossis EEPROM cov ntaub ntawv siv qhov chaw nyob qhev tshwj xeeb

● Lwv - tshem tawm cov cuab yeej NVM cov ntaub ntawv lossis EEPROM cov ntaub ntawv siv qhov chaw nyob qhev tshwj xeeb

● Sau - Loos thiab tom qab ntawv sau cov cuab yeej NVM cov ntaub ntawv lossis EEPROM cov ntaub ntawv siv qhov chaw nyob qhev tshwj xeeb. Cov lus txib no sau cov ntaub ntawv uas tau khaws tseg hauv nvmString lossis eepromString arrays.

● Ping - xa cov npe ntawm cov cuab yeej cuab tam chaw nyob uas txuas nrog I2C npav

Cov txiaj ntsig ntawm cov lus txib no yuav luam tawm mus rau lub console saib ua ntej.

Kauj Ruam 4: Lub Tswv Yim Qhia Ntawv thiab Kev Xyaum Ua Tau Zoo

Dhau ntawm kev txhawb nqa SLG46824/6, peb tau sau ob peb lub tswv yim qhia kom pab zam qhov tsis sib xws uas cuam tshuam nrog kev tshem tawm thiab sau ntawv mus rau NVM chaw nyob. Cov kab lus hauv qab no piav qhia lub ncauj lus kom ntxaws.

1. Ua Kom Zoo Tshaj 16-Byte NVM Nplooj Ntawv Sau:

Thaum sau cov ntaub ntawv rau SLG46824/6's NVM, muaj peb txoj hauv kev kom zam:

● Nplooj ntawv sau nrog tsawg dua 16 bytes

● Nplooj ntawv sau nrog ntau dua 16 bytes

● Nplooj ntawv sau uas tsis pib ntawm thawj zaug sau npe hauv ib nplooj ntawv (IE: 0x10, 0x20, thiab lwm yam)

Yog tias ib qho ntawm cov txheej txheem saum toj no tau siv, MTP interface yuav tsis quav ntsej I2C sau kom tsis txhob thauj NVM nrog cov ntaub ntawv tsis raug. Peb pom zoo ua I2C nyeem ntawm NVM chaw nyob tom qab sau ntawv txhawm rau txheeb xyuas cov ntaub ntawv hloov pauv raug.

2. Hloov NVM Cov Ntaub Ntawv rau hauv Matrix Configuration Registers

Thaum NVM tau sau, daim ntawv teev npe kev teeb tsa matrix tsis tau rov pib dua nrog cov ntaub ntawv NVM sau tshiab. Kev hloov pauv yuav tsum tau pib ua tus kheej los ntawm kev caij tsheb kauj vab PAK VDD lossis los ntawm kev tsim qhov muag pib siv I2C. Los ntawm kev teeb tsa npe hauv chaw nyob 0xC8, lub cuab yeej rov ua kom Power-On Reset (POR) ua ntu zus thiab rov ua cov ntaub ntawv sau npe los ntawm NVM rau hauv cov npe.

3. Rov pib dua I2C Chaw Nyob tom qab NVM Lwv:

Thaum NVM raug tshem tawm, NVM chaw nyob uas muaj I2C qhev qhov chaw nyob yuav raug teeb tsa rau 0000. Tom qab tshem tawm, lub nti yuav tswj hwm nws tus qhev tam sim no nyob hauv kev teeb tsa sau npe kom txog rau thaum lub cuab yeej rov pib dua raws li tau hais los saum no. Thaum lub nti tau rov pib dua, I2C chaw nyob qhev yuav tsum tau teeb tsa hauv chaw nyob 0xCA hauv kev teeb tsa sau npe txhua lub sijhawm GreenPAK yog lub zog hloov pauv lossis rov pib dua. Qhov no yuav tsum ua kom txog thaum nplooj ntawv tshiab I2C qhev tau sau hauv NVM.

Kauj Ruam 5: Sib tham tsis raug

Errata Kev Sib Tham
Errata Kev Sib Tham

Thaum sau ntawv mus rau “Nplooj Ntawv Lej Byte” (Chaw Nyob: 0xE3), SLG46824/6 ua rau tsis-I2C ua raws ACK tom qab “Cov Ntaub Ntawv” feem ntawm I2C hais kom ua. Tus cwj pwm no yuav raug txhais ua NACK nyob ntawm qhov ua tiav ntawm I2C tus tswv.

Txhawm rau ua raws li tus cwj pwm no, peb hloov kho Arduino programmer los ntawm kev tawm tswv yim tawm cov cai hauv daim duab 11. Ntu no ntawm cov cai ntsuas rau I2C ACK tom kawg ntawm txhua I2C hais kom ua hauv eraseChip () ua haujlwm. Txoj haujlwm no yog siv los lwv NVM thiab EEPROM nplooj ntawv. Txij li ntu ntu ntawm cov cai no nyob hauv For For loop, "rov qab -1;" kab ua rau MCU tawm ua ntej ntxov ua haujlwm.

Txawm hais tias muaj NACK, NVM thiab EEPROM tshem tawm cov haujlwm yuav ua kom raug. Txog kev piav qhia ntxaws ntawm tus cwj pwm no, thov siv "Qhov Teeb Meem 2: Tsis-I2C Ua Raws Li Tus Cwj Pwm Coj Tus Cwj Pwm rau NVM thiab EEPROM Page Erase Byte" hauv SLG46824/6 errata document (Revision XC) ntawm Dialog lub vev xaib.

Xaus

Hauv Cov Lus Qhia no peb piav qhia cov txheej txheem ntawm kev siv Arduino programmer los tshaj tawm cov cai NVM thiab EEPROM cov hlua rau GreenPAK IC. Cov cai hauv Arduino Sketch tau tawm tswv yim ntxaws, tab sis yog tias koj muaj lus nug txog kev kos duab, thov hu rau ib tus ntawm peb Tus Kws Tshaj Lij Ua Teb lossis tshaj tawm koj cov lus nug ntawm peb lub rooj sab laj. Yog xav paub ntau ntxiv txog MTP cov npe sau npe thiab txheej txheem, thov siv Dialog's In-System Programming Guide.

Pom zoo: