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

SETUP command 111H with Sub-command 010H #6

Open
maxpromer opened this issue Jun 7, 2018 · 2 comments
Open

SETUP command 111H with Sub-command 010H #6

maxpromer opened this issue Jun 7, 2018 · 2 comments

Comments

@maxpromer
Copy link

maxpromer commented Jun 7, 2018

Hello, thank you for make it code and your blog very good !

I have problem. i read your blog at http://blog.bouni.de/2012/the-mdb-protocol-part-3.html, the setup command (111H) will has 2 sub command : 000H and 0001H

I have VMC board. and i try send 100H (ACK) when Reset command and then send 000H 100H when PULL command and then VMC send it

+V: 0x111
+V: 0x010
+V: 0x111
+V: 0x010
+V: 0x117
+V: 0x117

Are you know about sub command 010H in SETUP command ?

Thanks !

This my code (Arduino) without UART file

extern void MDB_write(int data) ;
extern int MDB_read() ;
extern int MDB_available() ;
extern void MDB_setup() ;

void setup() {
  MDB_setup();

  Serial.begin(9600);
  Serial.println("Start !");

}

#define WAIT_DATA_1_Byte() { while (!(UCSR1A & (1 << RXC0))); }
#define READ_DATA_1_Byte() (((UCSR1B & 0x2) << 7) | UDR1)

int isReset = true;

void loop() {
  WAIT_DATA_1_Byte();
  int b = READ_DATA_1_Byte();
  if (b == 0x110) {
    WAIT_DATA_1_Byte();

    if (READ_DATA_1_Byte() == 0x010) {
      MDB_write(0x100);
      isReset = true;
      //Serial.println("Respont RESET command");
    }
  } else if (b == 0x112) {
    WAIT_DATA_1_Byte();

    if (READ_DATA_1_Byte() == 0x012) {
      if (isReset) {
        MDB_write(0x000);
        MDB_write(0x100);
        //Serial.println("Send Just reset");
        isReset = false;
      } else {
        MDB_write(0x100);
        //Serial.println("Send ACK");
      }
    }
  } else if ((b&0xF8) == 0x10) {
    Serial.print("+V: 0x");
    Serial.print(b >> 8, HEX);
    if ((b & 0xFF) < 0x10) Serial.print("0");
    Serial.print(b & 0xFF, HEX);
    Serial.println();
  }
}
@Bouni
Copy link
Owner

Bouni commented Jun 8, 2018

What type of device do you try to implement, a cashless device?

@maxpromer
Copy link
Author

I want to make cashless device.

Now, my code has bug. I use logic analyzer to debug i found VMC send 0x111 0x000 but my code show 0x111 0x010

Are you have guidance to fix my code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants