Git Product home page Git Product logo

ch375-arduino's Introduction

CH375-Arduino

  • This is an open source library for the Arduino development environment which simplifies the interaction with the CH375 USB controller chips.
  • Currently in very early development stage:
    • The CH375 supports communication with a microcontroller both via UART serial and via an 8-bit parallel bust, but at the moment onle the serial mode is supported.
    • Only supports USB host mode (CH375 can also work as a USB device but this is not supported yet and not a priority).
  • The goal is to provide a low-level API for USB requests (control transfers, bulk transfers, etc) as well as high-level APIs for the most common USB device classes (printer, HID, mass storage, etc.).
    • The low-level API is provided by the CH375 class (see CH375.h and CH375.cpp)
    • At the moment the only available high-level API is for the Printer device class (see CH375USBPrinter.h and CH375USBPrinter.cpp)
  • Currently the main target microcontroller is the ESP8266; tests are done using the EspSoftwareSerial library by Peter Lerup for ESP8266-CH375 communication. The example compiles for the AVR architecture as well but no testing has been done on AVR boards yet.

Useful links for development

General information about USB

CH375 documentation

Unfortunately there isn't a lot of English documentation about this chip. A lot of material that can be found on the manufacturer's website is only available in Chinese (which I don't understand), however I found that Google Translate can produce a quite readable English from it.

  • English datasheet
  • Official webpage - I used Google Translate to get to the Downloads section at the bottom of the page. There are some zips with C code examples for other microcontrollers (Intel MCS-51). Said source files have function and variable names in English but comments in Chinese. Copying and pasting these comments in Google Translate can give a decent understanding of what the code does.

ch375-arduino's People

Contributors

gianluca-nitti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ch375-arduino's Issues

CH375-Arduino

Hello!
When compiling with the Arduino Uno board, I get the following errors.

In file included from C:\Users\vvv\Documents\Arduino\libraries\CH375-Arduino-master\examples\USBPrinter\USBPrinter.ino:2:0:

C:\Users\vvv\Documents\Arduino\libraries\CH375-Arduino-master\src/CH375.h:3:22: fatal error: functional: No such file or directory

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

How can I fix errors?

does not work with EspSoftwareSerial

can't compile because of the line in the source code:
SoftwareSerial ch375swSer(CH375_RX, CH375_TX, false, 32);

printserver:47:56: error: no matching function for call to 'SoftwareSerial::SoftwareSerial(const uint8_t&, const uint8_t&, bool, int)'
47 | SoftwareSerial ch375swSer(CH375_RX, CH375_TX, false, 32);
| ^
In file included from C:\Users\garik\Downloads\printserver-esp8266-master\printserver\printserver.ino:21:
C:\Users\garik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\espsoftwareserial-main\src/SoftwareSerial.h:93:5: note: candidate: 'SoftwareSerial::SoftwareSerial(int8_t, int8_t, bool)'
93 | SoftwareSerial(int8_t rxPin, int8_t txPin = -1, bool invert = false);
| ^~~~~~~~~~~~~~
C:\Users\garik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\espsoftwareserial-main\src/SoftwareSerial.h:93:5: note: candidate expects 3 arguments, 4 provided
C:\Users\garik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\espsoftwareserial-main\src/SoftwareSerial.h:89:5: note: candidate: 'SoftwareSerial::SoftwareSerial()'
89 | SoftwareSerial();
| ^~~~~~~~~~~~~~
C:\Users\garik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\espsoftwareserial-main\src/SoftwareSerial.h:89:5: note: candidate expects 0 arguments, 4 provided
Используем библиотеку ESP8266WiFi версии 1.0 из папки: C:\Users\garik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi
Используем библиотеку espsoftwareserial-main версии 6.15.2 из папки: C:\Users\garik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\espsoftwareserial-main
Используем библиотеку CH375-Arduino-master версии 0.1.0 из папки: C:\Users\garik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\CH375-Arduino-master
exit status 1
no matching function for call to 'SoftwareSerial::SoftwareSerial(const uint8_t&, const uint8_t&, bool, int)'

if I remove "32" everything compiles but doesn't work. the program hangs when accessing the printer (getInfo()). there are no messages in serial. just hangs.

I understand EspSoftwareSerial is no longer compatible with CH375-Arduino.
please help to reconcile them. or choose the versions that are suitable for each other.

CH375USBPrinter.sendData missing?

Hi Gianluca,
I just read your code and want to implement this code for ESP32. But in file 'USBPrinter.ino' row 69 there is a function called:
printer.sendData(dataToPrint, len)
I can't find this function in 'CH375USBPrinter.cpp'. I haven't test your code in Arduino before.
Thank you.

Regards,
Nazmi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.