m5stack / M5StickC

M5StickC Arduino Library
MIT License
477 stars 222 forks source link

M5StickC CardKB First Time usage #85

Closed markbirss closed 3 years ago

markbirss commented 4 years ago

Hi

I run the CardBK example with the CardBK connected but get no repsonse on screen or when press keys.

Do I need to flash the CardBK first with the keyboard firmware or should it be already loaded?

pierreverbakel commented 4 years ago

Hello Mark,

I had also a non functioning test-app with the CardKB which I received today for M5StickC. I guessed it might have something to do with the Pin Number, since it is probably a ported App from M5Stack, that does not have HAT-Connector. So I changed the Wire.begin() line to Wire.begin(0, 26, 400000); Also I commented out the lines referring to GPIO5, since it would not work with them in. Maybe you get it working with the same change.

`#include

include

define CARDKB_ADDR 0x5F

void setup(){ M5.begin(); Serial.begin(115200); //Wire.begin(); Wire.begin(0, 26, 400000); // Changed by PV //pinMode(5, INPUT); // PV: What is on Pin 5? //digitalWrite(5, HIGH); M5.Lcd.fillScreen(BLACK); M5.Lcd.setRotation(3); M5.Lcd.setCursor(1, 10); M5.Lcd.setTextColor(YELLOW); M5.Lcd.setTextSize(2); M5.Lcd.printf("IIC Address: 0x5F\n"); M5.Lcd.printf(">>"); }

void loop(){ Wire.requestFrom(CARDKB_ADDR, 1); while(Wire.available()) { char c = Wire.read(); // receive a byte as characterif if (c != 0) { M5.Lcd.printf("%c", c); Serial.println(c, HEX); //M5.Speaker.beep(); } } // delay(10); }`

markbirss commented 4 years ago

@pierreverbakel

I will get back to you once I test you suggested changes, thank you

markbirss commented 4 years ago

@pierreverbakel

YES !

your suggested changes in fact solve both the issues i had, thank you !

ie

  1. The I2C_Tester M5StickC example would not detect my M5Stack CardBK on 0x5F, this is solved changing the example to specifically setting the connected pins

Wire.begin(32, 33, 400000);

20200119_160321

20200119_155337

and

  1. The M5StickC CardBK example working with your suggested removal of
  //pinMode(5, INPUT);
  //digitalWrite(5, HIGH);

and leaving

Wire.begin();

for me since I have the CardBK connected to the Grove port (GND, 5V, G32,G33)

M5StickC

also I re-flashed my other CardKB with another hex file to support PS/2 mode then using a PS2-to-USB adapter then can be used as a USB keyboard (Japanese layout)

Screenshot_20200119-161550_Gallery

markbirss commented 4 years ago

I notice even without setting specific pin configuration

Wire.begin();

also works now

pierreverbakel commented 4 years ago

Hey @markbirss Great ilustrated update on your work! I did not realize you have the standard keyboard, since I got myself a M5StickC-version (using the HAT-Connector), that did not work at first. So now both are supported, at least when using the correct Wire.begin(x,y,z); M5.begin() does a lot of initialisation. I did not dive into that, but most probably it has the right Wire.begin(x,y,z)-call in it already for the Grove-Connector.

markbirss commented 4 years ago

@pierreverbakel

Ah ok,

cable made up myself, with Tamakichi firmware, cut open PS2toUSB converter and connected USB side to CardKB

I used Raspberry Pi to flash keybaord with new hex file

https://github.com/markbirss/CardKeyBoard_PS2

This is the keyboard cover https://www.thingiverse.com/thing:3544822

Zontex commented 3 years ago

Hello, is the issue solved? if not please let us know how can we help. I'm closing this issue for now, if it's not solved - feel free to re-open it.