i think we could get it more stable without affecting performance too much. i haven’t measured the actual impact but i doubt this will make a huge difference. at some point we can play with the rate and run some simple tests and compare.

i had another extreme test running for over 10 hours with no crash and just tried setting slew time on one of the outputs and it seems fine. this is a modified version though so might not test what you want (i’m testing changes to improve screen refresh and keyboard response and i moved some of the work that was done with events/timers into the check_events loop, including CV updates - i think i’ll move this one back though). what did you have in mind?


been running another extreme test, 2ms metro script (writing to 32 TXo outputs, reading from TXi and ansible, updating one CV and one trigger on TT itself), and 4 trigger scripts (updating 2 TXo outputs, one TT CV and one TT trigger output, reading from TXi and ansible) being triggered at audio rates:

it hasn’t crashed yet. this version has fully responsive keyboard (even when using extreme trigger and metro rates) and no artifacts on screen refresh.

3 Likes

Basically, even though SPI is a lot faster than i2c (1mbs vs ~100kbs), it’s still slow compared to the speed that the CPU runs at. CV slew updates are done inside the timer interrupt, maybe that’s not a good idea…

It sounds like your version has moved all the SPI code out of a timer callback anyway?

Anecdotally it seems as though Teletype is now more stable than Ansible, I’ve been trying to think why. I think the big reason is probably the poor hygiene regarding swapping event handlers between modes, but I was also looking at the way that Ansible TT mode uses timers. That got me thinking about the SPI issue.


Excellent progress by the way!

1 Like

not all the SPI code (i think there are other calls elsewhere) but i did move the screen refresh and the CV refresh code out of the timer callbacks / event queue. i think i’ll move CV refresh back to the timer callback though - it’s set to run every 6ms, and it’s probably the most timing critical code, so the event loop is not a good place for it since an event can in theory take longer than 6ms.

it shouldn’t affect i2c anyway - timer interrupts have lower priority than i2c interrupts.

in what way? any specific issue? i’m running my tests with ansible firmware updated to my version of libavr32, i can test if the issue is still present.

1 Like

Nothing specific, just from my experience of it and from various threads. I guess that’s what I meant by “anecdotally”.

yes, in my initial testing updating teletype firmware made it more stable unless ansible commands were used - if i added any ansible commands it would still freeze pretty quickly. this was while using the official ansible firmware.

all my latest tests are done with ansible updated with my latest libavr32 and it seems much more stable now. but it’s entirely possible there are still some outstanding bugs in i2c code in ansible that are not libavr32 related.

1 Like

here is a short video showing improved screen refresh and keyboard response - this is with a 2ms metro script and 4 triggers getting hit at audio rates - previously this would make it sluggish to the point where you could hardly type anything (which made it difficult to get out of this state as it would be difficult to change the metro rate):

2 Likes

update:

with the latest fixes to improve screen and keyboard response i broke USB read/write, made some additional changes and was able to fix it. also moved CV updates back to a timer callback, which introduced issues with screen refresh again, so i went through all the SPI code and protected it with irqs_pause / irqs_resume which seems to have fixed the issue.

the latest code seems fine so far and i’ve been running an extreme test for almost 17 hours now with no crash.

at this point i don’t anticipate making any further changes, so my plan is to incorporate all the latest changes from the official 2.0 branch (including telex updates) and post beta versions for testing next week.

2 Likes

Anyone fancy trying to calculate how many milliseconds it takes to send a full screen refresh over SPI?

It might be useful to know.

:smiley:[quote=“scanner_darkly, post:150, topic:7564”]
at this point i don’t anticipate making any further changes, so my plan is to incorporate all the latest changes from the official 2.0 branch (including telex updates) and post beta versions for testing next week.
[/quote]

Don’t forget to post betas for everything if you keep the i2c speed change!

1 Like

yep, my plan is to post tt/ansible/trilogy firmwares all updated with the latest libavr32, not just for the i2c rate update but there are other changes as well that are important (most critical being the i2c interrupt level). anything using the older version will still be able to cause a crash.

3 Likes

@sam - all the latest changes are on github btw if you wanted to take a look! and i moved irqs_# methods from conf to src.

https://github.com/scanner-darkly/libavr32/tree/dev
https://github.com/scanner-darkly/teletype/tree/dev

2 Likes

Looks interesting… particularly the changes to check_event. I do think trying to find a better solution to the SPI issue than masking all interrupts might be worth exploring (but I don’t have the time to do it, so feel free to ignore me!).

Will try to digest once I’ve got rc1 out the door on Monday.

Are you going to squash the commits down before the PR? I take it the plan is still for this to make it into 2.1 right?

You’re going to have a lot of work coordinating the release of new code for all the modules… :cold_sweat: I feel for you.

(Won’t you need betas of TXi and TXo too? And JF…)

1 Like

a better solution for SPI would probably be a queue for SPI updates… but really not sure what is the best approach. at this point i’m just happy to have improved stability but this definitely needs more extensive testing with different scenarios and testing how well CVs are updated specifically, including slews (my latest extreme test has slew enabled on one of the outputs, btw, just to check how it affects stability - i think at this speed it doesn’t really have a chance to actually slew…).

yep, the plan is to beta test this separately from your 2.0 firmware - i’ll make sure any changes in your branch are merged. and then this can be released as 2.1 at some point likely including some other stuff - i also have some things in mind i want to add :slight_smile:

not sure about JF - TXi and TXo code doesn’t use libavr32, and so far doesn’t seem to cause any issues (another interesting thing to do would be compare i2c implementations between telex and libavr32 but i’ll leave that to somebody else i think…)

1 Like

:smiley:

Don’t you need to change the i2c rate though?

i had ansible at 132000 and tt at 100000 at one point and it didn’t seem to cause any issues. i doubt the i2c code negotiates the rate so probably has to be adjusted in the code, i’ll check where it’s set in telex.

1 Like

For the TELEX, it is set at 400k in the code - but the Teensy can do a lot faster.

This is the library that I used - optimized for the Teensy and based on the Arduino Wire library:

https://forum.pjrc.com/threads/21680-New-I2C-library-for-Teensy3

I don’t think we will need to do anything to the rates due to the nature of the protocol:

1 Like

now i remember you mentioning 400k before - this is interesting, when i tried 400k it was much less stable… but perhaps only the rate set on i2c master matters?

… the latest extreme test has been running with no crash for over 24 hours now.

2 Likes

i let it run for almost 54 hours before finally turning it off - no crash! at this point i feel it’s ready for beta testing but it makes sense to wait for 2.0 to be finalized as there are still some changes being made there and i want to make sure they’re all incorporated before we start beta testing this version.

if anybody wants to give it a try now though this would be super helpful. i’m also including updated ansible firmware here - it is important to update both as the older ansible firmware can still cause teletype to crash!

same for trilogy - if you use the latest official firmwares they might cause issues when using remote commands. i’ll post updated versions for each when we start beta testing, if you’d like to try it now just let me know and i’ll send you whichever one you need.


what to test? just try everything, throw anything you want at it. if you get it to crash it’s not necessary to retry it with the official 2.0 version - just post the description of your setup and the script (although if you have scripts that don’t work with the official version but work with this one please post that as well - it’ll be good to have additional confirmation that the fixes actually do work!)

teletype.hex (327.8 KB) c47eaaf

ansible.hex (225.1 KB) 85184e4

the teletype firmware includes all the latest changes to the official 2.0 version as of today (dedicated keys for pattern and live pages). remember that flashing firmware deletes your presets!

3 Likes

How do both the Ansible and the teletype firmware versions proposed above relate to the teletype beta / release candidate published by @sam today here:

And the fixed Ansible 1.5.1.b01published by @tehn here:

?

I am getting lost a bit what to install and test now…

to expand a bit…

@sam’s and @tehn’s versions you linked are the latest official beta versions. at this point we should concentrate on testing those versions. the ones i posted here are only for people willing to try my fix for teletype crashing under a heavy load (such as audio rate triggers or i2c commands in a fast metro script, for instance). my fix also includes improvements for keyboard response and screen refresh.

if your teletype doesn’t crash with the official version i’d use those versions. if you can get it to crash and have the time and desire to try my version this would be very helpful - but i am not asking for beta testing my version yet - i will do this once 2.0 is officially released. when that happens my version will include everything from the latest official versions and will likely include other stuff so that it can be considered 2.1 and will be tested as such.

for those who want to try the versions i posted - both ansible and teletype include everything from the official versions as of today (teletype rc1 and ansible 1.5.1b01).

3 Likes