[questions] my own teensy-based programmer

Hi guys

The 32 knob project partly made me buy my shrutis, and I’d love to try to develop a “teensy-based” (http://www.pjrc.com/teensy/) programmer for 2 reasons:

  • I’m sure it’s not that complicated with this type of card and I looove challenges
  • I’d like to drive two chained shruthis and choose which one I control (sh1, sh2 or sh1+sh2) which is not possible with fcd’s setup.

My “first-stage-development” questions are :

1) On the output expansion spot are 6 pads:
gnd (ok), +5V (ok), clk (probably a clock signal), EN (?), TX (?), Q7 (???)

what kind of signal do CLK, EN, TX and Q7 send/receive ?

2) looking at fcd’s schematics, I can see (I might bi wrong due to my newbiness in electronics) that all 4051 outputs to CV1 in of the shruthi…so how does the shruthi know which knob of the 32 was touched ?

3) to avoid my shruthi to run into “gremlins” mode when programmer is enabled, is it sufficient to send fixed values to the shruthi ?

4) what does my shruthi risk during development ?

This is just a beginning…It might be impossible to reach the end…but I’d like to have your advices.

Cheers,

Tom.

1) these are the lines to cascade 74xx595s, see the datasheet

2) the firmware adresses the 4051s via the 74xx595 and the 74xx137 so shruthi knows which pot is connected to cv1

3) yes. but you don send anything, its read by shruthi from cv1

4) you may kill your shruthi - no risk, no fun :wink:

One honest word: if you really dont know what CLK, EN, TX and Q7 mean maybe first go for a more simple project, the city of Rome wasnt build on one single day and this might be to big as a first attempt and might totally frustrate you… but id like to see your approach !

thanks fcd !

Your answers give me some clues to understand how your programmer works and how the shruthi works with your programmer !

for answer:

1) I’ll look more carefully at the datasheets tomorrow…but I think the light is coming ( welle it’s a bit less dark now)
2) so the shruthi adresses the four 4051 via 74xx595 and 74xx137…right ?
3) ok, nothing is sent…I made a “mispell”…I meant if the teensy board always sends values, the shruthi will always read these values (is that clearer ?)
4) ok, so i might buy a new shruthi for testing then…Olivier, when do you think the next batch will be for sale (the one starting tonight might be sold out if I decide to start my project…)

I’ll keep you adviced of my approach as I think some people here could be very helpful…I just need to get it clear in mind before submitting it in the forum !

I thought about what you’d want to achive: youd need a device that reads the 5 bits from the shift register and the analog value from 32 according pots and writes these values via a digital potentiometer to one ore more shruthi cv1 in… this is so complicated (and expensive…) you could do a 2nd programmer much easier.

1) EN, Q7 and CLK are the shift register, you can use those to write a few bits of data (such as the address of the pot to scan with Frank’s programmer).

TX is connector to the Shruthi-1’s second serial output. This serial output is not used, it’s up to you to hack the Shruthi-1 code to make it write some stuff there!

2), 3) Answered by fcd72

4) Nothing if you keep the voltages sent to the CV inputs between 0 and 5V

5) There are still a few kits available on the store.

6) As an exercise you could do something with your teensy that reads EN/CLK/Q7’ and writes a value to CV1 through a DAC, but it’s sad to do with an AVR what could be done with 74*****

Hi

So now I know what Q7’, EN and CLK mean…I understand one way of the signal…the return is kind of hard to me…

The atmega sends 8 bits to the shruthi’s 595.

Then Shruthi’s 595 is driving the leds (8 outputs, 8 leds to drive) and also sends its input “as-it” to the programmer using Q7’. The 5 first bits are then used to drive the programmer’s HC137 (2 bits) and to adress the 4051’s using S0, S1, S2 (3 bits). If you touch a pot, then it’s sent to the digiboard via CV1 (or IN1 ??). CV1 is an analogic signal…so how does the atmega understand which 4051 sent the info (via pin 3) ? Where is the loopback ? I’m missing a digital return somewhere…

By the way, just to know, I read you can use a 4051 as a demultiplexer…so what is the reason to use a 74HC137 ?? Question of price ? usability ?

Pichenettes, you find it sad to use a AVR to do this…It’s probably true for people like you or fcd who master electronics…For me, it’s just a wish to learn how to use a teensy and I apply this to a shruthi project…Regarding the price of a teensy, it’s not a big waste of money as I know I’ll use it for something else if my teensy-based programmer can’t be done

Indeed shruti sends 13 bits, the first 5 are pushed thru the onboard 595 to the 595 on the programmer and the second 8 stay onboard to drive the LEDs. This happens all the time, so Shruthi adresses frequently one specific Switch of one specific 4051 and reads the corresponding Value via CV1. It does not matter if you touch the knob, Shruthi just cycles thru all 32 knobs infinitely. The 137 is a 3to8 decoder, latched with inverted outs that you need to SELECT the 4051s, the 4051 is an analog switch. You could have misused a 4051 but the 137 already has all logic levels the right way and everything terminated nicely, you would have done this yourself when using a 4051.

Hi all

When you say shruthi sends 13 bits all the time…what is the frequency ? The 20 Mhz quartz is the clock source of the Atmega, right ? But what is the frequency of the Atmega’s clock for sending/receiving data to the shift register ? Pichenettes, do you use the 32kHz RTC ?

The CLK line sets the rhythm. 1 bit per raising edge on the CLK line.

I don’t know what’s the 32kHz RTC so I don’t think I use it :slight_smile:

To totally confuse you the speed of the CLK line drops depending on the work Shruthi has to do rendering Audio… your Programmer will have to adopt this - no fixed Speed :wink:

You should say would have to…I’m still not sure I can make it…I’m mainly thinking about it

so… you’d like to be discouraged?
just build one fcd programmer for each Shruthi! that gives you total access AND polychaining via midi!

No I’m not discouraged…But I’m not sure this will be possible For the moment, I just need to be sure I understand everything and what I’ve in mind is feasible !

My project doesn’t mean I won’t buy one of fcd’s programmer

What I’d like to do is being able, using polychaining, to:

  • modify shr1 parameters
    or
  • modify shr2 parameters
    or
  • modify both shr parameters (as with fcd’s programmer)

[edit] If I build 2 pfcd’s programmer, touching programmer 1 will act on second shruthi…and the price is not the same…[/edit]

And I think this should be possible if the teensy can act at the same time as the programmer and an emulation of the programmer:

  • a programmer to live modify the shruthi I choose
  • an “emulation” of the programmer to “lie” to the other shruthi, making it think a programmer is plugged.

Do you think this is impossible ?

i think it’s possible to disable the programmer if not needed somewhere in the menu. if that can be done without re-booting it would at least require some adjustments done by hand (i can’t tell).

but if you really want all the things you described, you can also use a midi controller and assign different shruthis to different midi channels for example.
i won’t mention a certain controller again, as i still haven’t done that too…

I think your project would be possible… but sometimes it’s tricky to do fast enough, in software, what logic gates IC can do at the blink of an eye.

If you were communicating with only one Shruthi, you could have used the hardware SPI interface on your teensy to “read” the CLK/DATA/ENABLE lines. But since you’re communicating with two Shruthis, you need two SPI interface so one of them will have to be emulated by software, so your code will have to use interrupt on edges of the CLK et ENABLE lines to “sense” what the Shruthi is writing. On fcd72’s programmer, the daddy who’s sensing the CLK and ENABLE lines are the law of physics.

You’ll also need to talk to a dual DAC to generate the CV sent to the two units. There are cute dual SPI DAC like the MCP4922, but wait, your SPI is already used to parse the CLK/DATA/ENABLE lines from one Shruthi! So you’ll need to bit-bang the SPI for the DAC. Arghh…

To sum up, you need 3 SPI ports, 2 to read the address from the Shruthi shift outputs, 1 to write to the DAC ; and you’ll have to decide which of those you are going to bit-bang, which of those you are going to do with the teensy onboard SPI interface. And if you do the two SPI input ports in software, you’ll have to juggle with 4 edge interrupts, which might be too much.

Now I personally think that everything that involves software serial/SPI (especially input) is not something that qualifies as a beginner project. Even I am trying to stay as far as I can from that - at the exception of bit-banging SPI out.

yes…but a midi controller is a way too easy solution isn’t it ? and btw, how can i, with a midi controller, simulteanously modify both shruthi’s if I set them to different channels (except if the midi controller is set to omni…but then if I want to modify only 1 shruthi, I have to reconfigure the midi controller so that it sends data on the desired channel…)

For the MIDI controller thing: build your own MIDI controller with the teensy, and program it in a way that when you turn a knob it sends the CC message twice on 2 different channels.

It’s easy doable, all you need is some kind of Processor with a bunch of digital INs for reading the 595 signals from your Shruthis, some digital OUTs to adress a similar Logic as in the Programmer to scan the Pots, a AD for reading the Pots and a DA for every Shruthi you want to connect. The Hardware is the easy part :wink:

Then youll have to write the software that reads the many asyncronous digital lines from your Shruthis (Pain in the ass - you have to build everything from scratch) and generates the according analog signals Shruthi reads in sync and while doing this for all the Shruthis you want to connect, dont forget to scan your Pots.

So i think from an time-economic point of view you should go for the MIDI based approach rosch describes above.

and it already exists, so you won’t have to re-invent the wheel:
http://www.ucapps.de/
it’s the midibox64 for example.

I might haven’t been clear enough explaining my idea…

In fact, the programmer would be an association of a teensy AND some 4051…so the CV signal doesn’t have to pass thru a DAC to reach the shruthi CV1 in…

The teensy would only be used to store CV and address bytes to simulate a programmer when shruthi parameters are not intended to be modified: shruthi 1 values are stored and virtually “sent” to itself at the same time shruthi 2 parameters are physically modified…

But writing this, I can see another problem coming: if I want to tweak both shruthi’s at the same time, this means that both shruthis are scanning the same pots at the same time…which is probably not the case…Doh !

Well, I’ll think of that tomorrow…

Anyway, thx for the quick answers guys ven if my setup is finally not possible, It would have put my first finger in (a very tiny little part of) electronics understanding…

See you soon

Tom.