-
Notifications
You must be signed in to change notification settings - Fork 190
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
Teensy LC: conflict between I2C and ADC #139
Comments
I know @tomcombriat has addressed at least the compilation problem in https://github.com/sensorium/Mozzi/pulls . Could you test whether that also fixes the hang? |
Hi, |
Hi, |
Hi, Also, you said:
Does that means that the I'll try to have a closer look tomorrow, probably will need a big dive into Teensy source code… The Teensy LC is slightly different from the 3.2, it has only one converter. I don't have a TeensyLC unfortunately but I'll already re-test that on the 3.2. Best, |
Just to confirm: Just to comment: probably, just I'm also wondering if Teensy LC has ever been tested before on Mozzi… It is not mentioned in the main page of Mozzi. Maybe @sensorium can enlighten us on this! |
i do not have Teensy 3.2 available here at the moment, only an LC, a 3.6 and a 4.0 ... I think the LC is a great platform for Mozzi, offering usbMidi and a powerful CPU at relatively low cost :) |
yes, i am using Teensyduino 1.55 with Arduino 1.8.16 |
I agree, but the import taxes here, it is nearly as expensive to buy a 3.2, that's why I never went for the LC unfortunately… I still haven't understood why the 3.2 works here (with correct
Does that mean that it compiled ok on LC (without errors or warnings) and that it runs without hanging at the first mozziAnalogRead using Thanks! |
Hi,
intersting... here in Austria we get the TeensyLC for ~11€, where the 3.2 costs ~20€ (both including taxes)!
yes - the code compiles/builds okay without changes.
yes - mozziAnalogRead does not freeze anymore ...
I made a small demo-sketch which prints the ADC-values of channels 0-8 using mozziAnalogRead in the updateContol() callback (with a CONTROL_RATE of 64). here the result: chn 0:353637138 chn 1:22 chn 2:0 chn 3:334 chn 4:40702 chn 5:0 chn 6:1003 chn 7:68 chn 8:757 When i turn connected potentiometers, the changing voltages are not reflected in the ADC-readouts (which works when i use the plain analogRead() instead - thanks for the hint BTW!) Note that chn4 shows constantly increasing values which seem to be milliseconds (!) - could be a timer register value, indicating a configuration problem of the ADC/Timer unit ?
i heard a strange noise when i ran my synthesizer sketch using the Teensy4X-branch last time - however i can't reproduce this problem after the last pull - this one seems to be fixed :-) or it was caused by a mistake at my end ;-) |
Wow, look at these values for channel 0 (I presume it is pin A0?)! Channel 4 indeed increases, and it is the only one… Seems indeed like a counter, but of what… Thanks very much for all these tests! At least it compiles ok… I just commit my last trump card on Teensy are great platforms so the Thanks very much for all your testings and your detailed reports :) ! |
hi, I applied your recent change to
yes. the printloop is
if I replace
it looks indeed as if the current value of the passed milliseconds is reflected in chn4 .....
no problem, this was no hassle at all! thanks for your work on this great library :) |
Hei again! Arf, too bad, I had great hopes in this one! Well, I'll get my hands on a Teensy LC (probably in the next couple of weeks) and try to get it sorted. I kinda feel Teensy is trying its best to make all these 32bits boards compatible so I do not understand why this is not working. I feel it has something to do with the fact that there is only one ADC but even when there is two mozzi is only using one anyway…
I thing this is not increasing enough for a milliseconds count at control_rate… But it might be related to that! Like a count of CPU clock divided by something… |
Hei, Best |
Should be solved by #138 |
hi! thank you for having such a close look at the issue! |
The never ending story… At least the ADC works when no I2C interface is used. The I2C interface is obviously on the same pins than the ADC, there might be a conflict somewhere. In case you have a minimal non-working example in order for me to try to work on I would be grateful. Otherwise no big deal! |
Using the current master branch, I got some compile error when building for the Teensy 3.2 / LC boards, in particular I had to change lines
Mozzi/MozziGuts.cpp
Line 399 in 8df22c9
to
adc->adc0->setAveraging(0);
adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::MED_SPEED);
to get the build done. But then, every sketch which uses the ADC hangs at mozziAnalogRead ...
I found that the hang does not happen when i prevent adc interrupts by commenting this line:
Mozzi/mozzi_analog.cpp
Line 74 in 8df22c9
After that, mozziAnalogRead does not provide correct ADC results, but a workaround is to create your own adc instance in the Arduino sketch, and read the adc values by e.g.
ADC *myadc = new ADC();
(...)
int value=myadc->adc0->analogRead(A1);
works fine in a Mozzi setup with 8 potentiometers ...
The text was updated successfully, but these errors were encountered: