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

PCA9685-PWM init時にRemote I/O error が発生する #54

Open
rasp753 opened this issue Feb 13, 2020 · 2 comments
Open

PCA9685-PWM init時にRemote I/O error が発生する #54

rasp753 opened this issue Feb 13, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@rasp753
Copy link
Contributor

rasp753 commented Feb 13, 2020

pca9685をNode.jsで動かした際にinit()時にRemote I/O errorが発生する。

ブランチpca9685-pwmのnode-example/pca9685-pwm/example1.jsで発生。
配線はschematic1.pngの通りに配線しました。

エラーログ

(node:2745) ExperimentalWarning: The fs.promises API is experimental
a
b
(node:2745) UnhandledPromiseRejectionWarning: OperationError: Error: , Remote I/O error
    at Object.write8 (/home/pi/chirimen-drivers/node-examples/pca9685-pwm/node_modules/node-web-i2c/index.js:58:27)
(node:2745) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2745) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@rasp753 rasp753 added the bug Something isn't working label Feb 13, 2020
@kou029w kou029w removed the bug Something isn't working label Feb 13, 2020
@kou029w
Copy link
Collaborator

kou029w commented Feb 13, 2020

SDカードの中身の途中のコードを見ると

  await pca9685_pwm.init();

と書かれておりましたが、いまの@chirimen/pca9685-pwmの実装では引数に周波数を取る実装になってます

実装:

init: async function(frequency, noSetZero) {

このため、引数を省略した際に参照出来ず何らかの不正な値に暗黙的な変換が行われたのではないかと想像しますが、この点に関していかがでしょうか
ご確認の程よろしくお願いします。

使い方に関してはCHIRIMENのExamplesのサンプルコードを参照:
https://github.com/chirimen-oh/chirimen/blob/fca0d6d5f6a257f68d4406e20f081b868285f3c4/gc/contrib/examples/gpio-i2c-PWMHBridge1/main.js#L18
https://github.com/chirimen-oh/chirimen/blob/fca0d6d5f6a257f68d4406e20f081b868285f3c4/gc/contrib/examples/gpio-i2c-PWMHBridge2/main.js#L13

@kou029w kou029w added the bug Something isn't working label Feb 13, 2020
@kou029w
Copy link
Collaborator

kou029w commented Feb 13, 2020

引数を省略した際に参照出来ず

と思ったらデフォルト60Hzになるように書かれてました
となると原因は何でしょうかねぇ。。
例えばブラウザのCHIRIMENと同時使うなど他に干渉する要素が無さそうなら、単純にI2CSlaveDevice.write()を繰り返し呼び出すだけでエラーになる、ということですかねぇ

if (frequency) {
this.frequency = frequency;
} else {
this.frequency = 60; // default: 60Hz
}
var freq = Math.floor(25000000 / (4096 * this.frequency) - 1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants