I don't want to bother you with stupid problems, but…
something really unexpected is happening, at least on my STM32F4DISCOVERY board.
I checked on two different boards, the behavior was the same.
Then taking for grant a same board, I went back installing the past versions of Espruino.
When I installed version 1v41 the SPI behaved as expected.
Using later version I always got ZERO as output.
When I checked with the scope , seeing no data activity over theMISO , MOSI lines but correct clocks over the SCK line, I was using version 1v51.( my custom complilation )
The same wrong behavior happens with my backup versions: 1v48, 1v50.
I am going to look deeply at the code.
I noticed this behavior just now, because other functionalities gave no problems, so I proceeded installing new versions.
Is there a place in the code were I can easily and immediately check for ?
Of course the Javascript code was the same.
function onInit() {
SPI1.send([0x20,0b01000111], E3);
}
var avrx=0.0, avry=0.0;
function getAcc() {
var accx = SPI1.send([0xA9,0], E3)[1];
var accy = SPI1.send([0xAB,0], E3)[1];
if (accx>127) accx-=256;
if (accy>127) accy-=256;
avrx = 0.1*accx + 0.9*avrx;
avry = 0.1*accy + 0.9*avry;
console.log("X= "+avrx+" Y= "+avry);
}
onInit();
var t = setInterval(getAcc, 10);
// clearInterval(t);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I don't want to bother you with stupid problems, but…
something really unexpected is happening, at least on my STM32F4DISCOVERY board.
I checked on two different boards, the behavior was the same.
Then taking for grant a same board, I went back installing the past versions of Espruino.
When I installed version 1v41 the SPI behaved as expected.
Using later version I always got ZERO as output.
When I checked with the scope , seeing no data activity over theMISO , MOSI lines but correct clocks over the SCK line, I was using version 1v51.( my custom complilation )
The same wrong behavior happens with my backup versions: 1v48, 1v50.
I am going to look deeply at the code.
I noticed this behavior just now, because other functionalities gave no problems, so I proceeded installing new versions.
Is there a place in the code were I can easily and immediately check for ?
Of course the Javascript code was the same.
function onInit() {
SPI1.send([0x20,0b01000111], E3);
}
var avrx=0.0, avry=0.0;
function getAcc() {
var accx = SPI1.send([0xA9,0], E3)[1];
var accy = SPI1.send([0xAB,0], E3)[1];
if (accx>127) accx-=256;
if (accy>127) accy-=256;
avrx = 0.1*accx + 0.9*avrx;
avry = 0.1*accy + 0.9*avry;
console.log("X= "+avrx+" Y= "+avry);
}
onInit();
var t = setInterval(getAcc, 10);
// clearInterval(t);
X= 10.342832 Y= -1.9707
X= 10.308549 Y= -1.97363
X= 10.277694 Y= -2.076267
X= 10.249925 Y= -2.06864
X= 10.224932 Y= -2.061776
X= 10.302439 Y= -2.055598
X= 10.272195 Y= -2.050039
X= 10.244975 Y= -2.045035
X= 10.220478 Y= -2.140531
X= 10.29843 Y= -2.026478
X= 10.268587 Y= -2.02383
X= 10.241728 Y= -2.021447
X= 10.317555 Y= -2.019302
X= 10.2858 Y= -2.017372
X= 10.25722 Y= -2.015635
X= 10.331498 Y= -2.014071
X= 10.298348 Y= -2.012664
X= 10.268513 Y= -2.011398
X= 10.241662 Y= -2.010258
X= 10.217495 Y= -2.009232
X= 10.295746 Y= -2.008309