PIC I2C Master Crash

Discussion in 'General Electronics Chat' started by Robin Mitchell, Aug 28, 2013.

  1. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    732
    199
    Hi everyone,

    So im using a PIC18F45k20 as a I2C master control and it makes the controller of a laser tag gun. Now I have clips that load into the gun which contain an I2C EEPROM that inform the PIC of the ammo contents.

    Here is the problem:

    Sometimes if I either put the clip in or take the clip out it causes the PIC to crash and stop entirely leaving SDA and SCL (RC3 and RC4) permanently high. I dont have the code for the PIC on this computer but this happens regardless of any I2C operation. The program looks at an EEPROM located at address 001 but the clip is 000. So even if an operation is occurring with 001 attaching and detaching 000 should make no problem.

    Is the removal/addition of the device causing a problem with the bus? Does the PIC I2C Module hate removals and why would it stop?

    Any help would be great!

    All the best,
    Robin
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    As long has the PIC has Vcc and an oscillation method, there is virtually no way you can get it to STOP. It will keep executing instructions until hell freezes over. External events can make it execute code that you did not intend which is a great deal more likely.

    An I2C master has a great deal of flexibility in dealing with a bus that does not behave such as when a device is being inserted or removed. Too bad you don't have access to the code.
     
    Robin Mitchell likes this.
  3. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    732
    199
    Ok I shall post it sooner tonight (I will transfer it from the workshop ;) )
     
  4. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    732
    199
    Here is the main.c file

    Code ( (Unknown Language)):
    1.  
    2. /** C O N F I G U R A T I O N   B I T S ******************************/
    3.  
    4.  
    5. /** I N C L U D E S **************************************************/
    6. #include "p18f45k20.h"
    7. #include "delays.h"
    8. #include "IntOSC.h"
    9. #include "math.h"
    10. #include <string.h>
    11. #include "i2c protocol.h"
    12.  
    13.  
    14. /** V A R I A B L E S *************************************************/
    15. #pragma udata // declare statically allocated uninitialized variables
    16.  
    17. char sound        = 0;
    18. char sound_start_over = 0;
    19. unsigned char ammo_tens = 6;
    20. unsigned char ammo_digit= 0;
    21. unsigned char total_ammo =60;
    22. unsigned char temp;
    23.  
    24. int boot = 800;      
    25. int address = 0;
    26. int cool_down_trigger = 0;
    27. int cool_down_display = 0;
    28. int led_cooldown = 0;
    29.  
    30. char address_high = 0;
    31. char address_low = 0;    
    32. unsigned char clip_present = 0;
    33. unsigned char ack;
    34.  
    35.  
    36.  
    37. /** D E C L A R A T I O N S *******************************************/
    38. // declare constant data in program memory starting at address 0x180
    39. #define SEG1        LATCbits.LATC5
    40. #define SEG2        LATCbits.LATC6
    41. #define TRIGGER        PORTCbits.RC7
    42. #define NUM0 0b00111111
    43. #define NUM1 0b00000110
    44. #define NUM2 0b01011011
    45. #define NUM3 0b01001111
    46. #define NUM4 0b01100110
    47. #define NUM5 0b01101101
    48. #define NUM6 0b01111101
    49. #define NUM7 0b00000111
    50. #define NUM8 0b01111111
    51. #define NUM9 0b01100111
    52. #define LED            LATCbits.LATC0
    53.      
    54.  
    55.  
    56. void display_digit(char number, char port);
    57. void load_ammo();
    58.  
    59.  
    60. void main (void)
    61. {
    62.     ANSELH = 0x00;                 // AN8-12 are digital inputs (AN12 on RB0)
    63.     OSCCON = 0x70;              // IRCFx = 110 (8 MHz)
    64.     OSCTUNEbits.PLLEN = 1;      // x4 PLL enabled = 32MHz
    65.    
    66.     address = 0;
    67.     sound_start_over = 0;
    68.  
    69.     TRISA = 0x00;
    70.     TRISB = 0xFF;
    71.     TRISC = 0b10011000;
    72.     TRISD = 0x00;
    73.    
    74.     TRISBbits.TRISB4 = 0;
    75.  
    76.     I2CInit();    
    77.     I2CStart();
    78.     I2CSend(0b10100010);    
    79.     I2CSend(0);
    80.     I2CSend(0);
    81.     I2CStop();
    82.  
    83.        
    84.     do
    85.     {
    86.         I2CWait();
    87.         I2CStart();
    88.            I2CSend(0b10100011);
    89.         I2CWait();
    90.                
    91.         temp = I2CRead() - 0x60;
    92.         LATD = temp;
    93.         I2CWait();
    94.         I2CStop();
    95.        
    96.        
    97.        
    98.         // Check a clip is present
    99.         do
    100.  
    101.            {
    102.                I2CStart();
    103.                I2CSend(0b10100000);
    104.                
    105.            }while(SSPCON2bits.ACKSTAT == 1);
    106.      
    107.            I2CStop();    
    108.      
    109.    
    110.    
    111.    
    112.         if(address >= 5000)
    113.         {
    114.             address = 0;
    115.             sound = 0;
    116.             LATD = 0;
    117.         }
    118.  
    119.        
    120.         if(sound_start_over == 1)
    121.         {
    122.             address = 0;
    123.             sound = 1;
    124.             sound_start_over = 0;
    125.         }
    126.        
    127.  
    128.         if(sound == 1)
    129.         {
    130.  
    131.             address ++;                    
    132.         }
    133.        
    134.         // Trigger pressed
    135.         if(TRIGGER == 1 && cool_down_trigger == 0 && (total_ammo > 0))
    136.         {
    137.             sound = 1;
    138.             cool_down_trigger = 500;
    139.             sound_start_over = 1;
    140.             led_cooldown = 3;
    141.            
    142.             total_ammo --;        
    143.            
    144.             if(ammo_digit == 0)
    145.             {
    146.                 ammo_digit = 9;
    147.                 ammo_tens --;
    148.             }
    149.             else
    150.             ammo_digit --;
    151.            
    152.  
    153.            
    154.         }
    155.        
    156.  
    157.         if(cool_down_display == 0)
    158.         {
    159.             if(sound == 1)
    160.             cool_down_display = 1;
    161.             else
    162.             cool_down_display = 1;
    163.  
    164.             display_digit(ammo_digit, 2);
    165.             display_digit(ammo_tens, 1);
    166.             SEG1 = 0;
    167.             SEG2 = 0;
    168.         }
    169.        
    170.         if(cool_down_trigger != 0)
    171.         cool_down_trigger --;
    172.    
    173.         if(cool_down_display != 0)
    174.         cool_down_display --;
    175.  
    176.         if(led_cooldown!= 0)
    177.         {
    178.             LATCbits.LATC0 = 1;
    179.             led_cooldown --;
    180.         }
    181.         else
    182.         LATCbits.LATC0 = 0;
    183.        
    184.     }while(1);        
    185.  
    186. }
    187.  
    188.  
    189.  
    190. void display_digit(char number, char port)
    191. {
    192.     SEG1 = 0;
    193.     SEG2 = 0;
    194.  
    195.     switch(number)
    196.     {
    197.         case 0:
    198.         LATA = NUM0;
    199.         break;
    200.        
    201.         case 1:
    202.           LATA =  NUM1;
    203.         break;
    204.  
    205.         case 2:
    206.         LATA = NUM2;
    207.         break;
    208.  
    209.         case 3:
    210.         LATA = NUM3;
    211.         break;
    212.  
    213.         case 4:
    214.         LATA = NUM4;
    215.         break;
    216.        
    217.         case 5:
    218.         LATA = NUM5;
    219.         break;
    220.        
    221.         case 6:
    222.         LATA = NUM6;
    223.         break;
    224.  
    225.         case 7:
    226.         LATA = NUM7;
    227.         break;
    228.  
    229.         case 8:
    230.         LATA = NUM8;
    231.         break;
    232.  
    233.         case 9:
    234.         LATA = NUM9;
    235.         break;
    236.        
    237.         default:
    238.         LATA = NUM0;
    239.         break;
    240.     }    
    241.    
    242.         if(port == 1)
    243.     {
    244.         SEG1 = 1;
    245.     }            
    246.  
    247.     if(port == 2)
    248.     {
    249.         SEG2 = 1;
    250.     }            
    251.  
    252. }
    253.  
    254.  
    255. void load_ammo()
    256. {
    257.     // Set address pointer
    258.      I2CStart();
    259.     I2CSend(0b10100000);    
    260.     I2CSend(0);
    261.     I2CSend(0);
    262.     I2CStop();
    263.    
    264.     I2CWait();
    265.     I2CStart();
    266.        I2CSend(0b10100011);
    267.     I2CWait();
    268.        
    269.  
    270.     total_ammo = I2CRead();
    271.     I2CWait();
    272.     ammo_tens  = I2CRead();
    273.     I2CWait();
    274.     ammo_digit = I2CRead();
    275.     I2CWait();
    276.     I2CStop();    
    277.    
    278. }
    279.  
    Here is the I2C Protocol header file

    Code ( (Unknown Language)):
    1.  
    2. #ifndef I2CPROTOCOL_H
    3. #define I2CPROTOCOL_H
    4. #include "p18f45k20.h"
    5.  
    6. // Function Prototypes
    7.  
    8. #define SCL_OUTPUT        TRISCbits.TRISC3 = 0;
    9. #define SCL_INPUT        TRISCbits.TRISC3 = 1;
    10. #define SDA_OUTPUT        TRISCbits.TRISC4 = 0;
    11. #define SDA_INPUT        TRISCbits.TRISC4 = 1;
    12. #define SCL_ON            LATCbits.LATC3 = 1;
    13. #define SCL_OFF            LATCbits.LATC3 = 0;
    14. #define SDA_ON            LATCbits.LATC4 = 1;
    15. #define SDA_OFF            LATCbits.LATC4 = 0;
    16. #define SDA_IN            PORTCbits.RC4;
    17.  
    18. void I2CInit(void);
    19. void I2CStart();
    20. void I2CStop();
    21. void I2CRestart();
    22. void I2CAck();
    23. void I2CNak();
    24. void I2CWait();
    25. void I2CSend(unsigned char dat);
    26. unsigned char I2CRead(void);
    27.  
    28.  
    29. /*
    30. Function: I2CInit
    31. Return:
    32. Arguments:
    33. Description: Initialize I2C in master mode, Sets the required baudrate
    34. */
    35. void I2CInit(void){
    36.         TRISCbits.TRISC3 = 1;      /* SDA and SCL as input pin */
    37.         TRISCbits.TRISC4 = 1;      /* these pins can be configured either i/p or o/p */
    38.         SSPSTAT |= 0x80; /* Slew rate disabled */
    39.         SSPCON1 = 0x28;   /* SSPEN = 1, I2C Master mode, clock = FOSC/(4 * (SSPADD + 1)) */
    40.         SSPADD = 0x27;   /* 100Khz @ 4Mhz Fosc */
    41. }
    42.  
    43. /*
    44. Function: I2CStart
    45. Return:
    46. Arguments:
    47. Description: Send a start condition on I2C Bus
    48. */
    49. void I2CStart(){
    50.         SSPCON2bits.SEN = 1;         /* Start condition enabled */
    51.         while(SSPCON2bits.SEN);      /* automatically cleared by hardware */
    52.                      /* wait for start condition to finish */
    53. }
    54.  
    55. /*
    56. Function: I2CStop
    57. Return:
    58. Arguments:
    59. Description: Send a stop condition on I2C Bus
    60. */
    61. void I2CStop(){
    62.         SSPCON2bits.PEN = 1;         /* Stop condition enabled */
    63.         while(SSPCON2bits.PEN);      /* Wait for stop condition to finish */
    64.                      /* PEN automatically cleared by hardware */
    65. }
    66.  
    67. /*
    68. Function: I2CRestart
    69. Return:
    70. Arguments:
    71. Description: Sends a repeated start condition on I2C Bus
    72. */
    73. void I2CRestart(){
    74.         SSPCON2bits.RSEN = 1;        /* Repeated start enabled */
    75.         while(SSPCON2bits.RSEN);     /* wait for condition to finish */
    76. }
    77.  
    78. /*
    79. Function: I2CAck
    80. Return:
    81. Arguments:
    82. Description: Generates acknowledge for a transfer
    83. */
    84. void I2CAck(){
    85.         SSPCON2bits.ACKDT = 0;       /* Acknowledge data bit, 0 = ACK */
    86.         SSPCON2bits.ACKEN = 1;       /* Ack data enabled */
    87.         while(SSPCON2bits.ACKEN);    /* wait for ack data to send on bus */
    88. }
    89.  
    90. /*
    91. Function: I2CNck
    92. Return:
    93. Arguments:
    94. Description: Generates Not-acknowledge for a transfer
    95. */
    96. void I2CNak(){
    97.         SSPCON2bits.ACKDT = 1;       /* Acknowledge data bit, 1 = NAK */
    98.         SSPCON2bits.ACKEN = 1;       /* Ack data enabled */
    99.         while(SSPCON2bits.ACKEN);    /* wait for ack data to send on bus */
    100. }
    101.  
    102. /*
    103. Function: I2CWait
    104. Return:
    105. Arguments:
    106. Description: wait for transfer to finish
    107. */
    108. void I2CWait(){
    109.       while ( ( SSPCON2 & 0x1F ) || ( SSPSTAT & 0x04 ) );
    110.     /* wait for any pending transfer */
    111. }
    112.  
    113. /*
    114. Function: I2CSend
    115. Return:
    116. Arguments: dat - 8-bit data to be sent on bus
    117.            data can be either address/data byte
    118. Description: Send 8-bit data on I2C bus
    119. */
    120. void I2CSend(unsigned char dat){
    121.    
    122.         SSPBUF = dat;    /* Move data to SSPBUF */
    123.         while(SSPSTATbits.BF);       /* wait till complete data is sent from buffer */
    124.         I2CWait();       /* wait for any pending transfer */
    125. }
    126.  
    127. /*
    128. Function: I2CRead
    129. Return:    8-bit data read from I2C bus
    130. Arguments:
    131. Description: read 8-bit data from I2C bus
    132. */
    133. unsigned char I2CRead(void){
    134.         unsigned char temp;
    135. /* Reception works if transfer is initiated in read mode */
    136.         SSPCON2bits.RCEN = 1;        /* Enable data reception */
    137.         while(!SSPSTATbits.BF);      /* wait for buffer full */
    138.         temp = SSPBUF;   /* Read serial buffer and store in temp register */
    139.         I2CWait();       /* wait to check any pending transfer */
    140.         return temp;     /* Return the read data from bus */
    141. }
    142.  
    143.  
    144. #endif
    145.  
     
  5. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    732
    199
    I should note that the crash occurs regardless of the code below in main.c
    Code ( (Unknown Language)):
    1.  
    2.         // Check a clip is present
    3.         do
    4.  
    5.            {
    6.                I2CStart();
    7.                I2CSend(0b10100000);
    8.                
    9.            }while(SSPCON2bits.ACKSTAT == 1);
    10.      
    11.            I2CStop();    
    12.  
     
  6. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    732
    199
    Something interesting I just found out.

    The same problem can be recreated if you temporarily connect the SDA line and SCL together.

    ALso found out that the SCL is constantly held low
     
    Last edited: Aug 28, 2013
  7. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    You have a loop that depends on only one condition. This is the road to Embedded Software Perdition. Everytime you have a condition that is false you need to check for other conditions that might be true and take appropriate action. I would expect to see code that would do an I2C bus STOP whenever any suspicious behavior is detected. Don't forget to observe the minimum Bus Free time between a STOP and a subsequent START (4.7 μsec in Standard Mode)

    I understand you are trying to get something working; just don't expect it to be bulletproof out of the gate. Do you have a copy of the I2C specification? Mine is version 2.1 dated January 2000(NXP Semiconductors, formerly Philips). Search for Application Notes published by device manufacturers with I2C code for specific devices. You will learn a ton by reading them.
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605

    I believe I've had similar problems as you when doing some debugging of I2C code. What I believe was happening was I would occasionally stop the debugger during an I2C transaction, and if I hit the wrong place it would stall the bus.

    I never tracked it down totally but as I recall it was the SDA line (not SCL) that was stuck low on the slave end: I believe a NAK was in progress when the PIC was reset. So next time the PIC tries to talk, it sees SDA low, assumes another master is talking, and patiently waits till the transaction ends.

    Of course, with no other master on line the transaction never ends, and the program hangs.

    My workaround was on start up to always manually toggle the SCL line 9 times: that guarantees a transaction NAK is well in the past. By "manually" I mean toggle the port bit directly, not thru the I2C module.

    The only time I know a slave can hold SCL low is when it needs some extra time to process a transaction, but that is a momentary and very fast event.
     
    Robin Mitchell and Papabravo like this.
  9. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    If you know you are the only master it helps considerably. You need to crawl and walk before you try to run a marathon. If you are the master you need to establish that you are in control of the bus lines EXCEPT when you are in the middle of an ACK or a DATA transfer. If the bus lines are not in the state you think they should be in, you need to force them by sending STOP commands, and then waiting.
     
    Robin Mitchell likes this.
  10. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I2C is a mongrel for plug and play. Not a great choice.

    You are much better off with SPI (although that takes 3 lines) and you can source SPI EEPROMS just as easy.

    Since this is a low datarate application my preference would be asynchronous serial (TTL USART serial). That would mean instead of an EEPROM in the clips you could use a really cheap PIC like a 10F series (or the slightly more costly 12F series if you prefer).
     
    Robin Mitchell likes this.
  11. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    732
    199
    TELL ME WHERE IS IT! I SHALL DESTROY IT!

    Thanks for all of this great feedback :)

    All the best,
    MitchElectronics
     
  12. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Consider the last line of this function:

    Code ( (Unknown Language)):
    1.  
    2. void I2CAck(){
    3.          SSPCON2bits.ACKDT = 0;       /* Acknowledge data bit, 0 = ACK */
    4.          SSPCON2bits.ACKEN = 1;       /* Ack data enabled */
    5.          while(SSPCON2bits.ACKEN);    /* wait for ack data to send on bus*/
    6. }
    If the I2C breaks you get stuck there forever.

    Such patterns are common in your code, and most I2C code I've seen. It was what I was working on when I was debugging that I2C code (which was for the PIC32 series so isn't very useful to you).
     
  13. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    I don't necessarily agree with this. Like anything else there are pros and cons. I've not seen any devices that I couldn't make work after a period of investigation, careful coding, and insightful debugging. They are certainly easier than USB and Ethernet.
     
  14. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I believe I've found a semantic equivalent to the "mongrel" comment:
     
    THE_RB and Papabravo like this.
  15. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I don't think I2C was ever meant for plug and play. It's critical for things like its start and stop conditions which means holding one line in a particular state while the other line goes from lo->hi or hi->lo. That's all bad juju for plug and play systems, even if you mess with pullup resistors etc.

    Another issue for I2C is that comms must be bidirectional and send device addresses etc, and both master and slave need to be able to pull the same wires low etc. That's just a heap more stuff to go wrong.

    SPI is better as the only critical transition is the clock pulse \ edge etc, so with pullup resistors on both master and slave devices you can be pretty safe knowing the clock line stays hi at all times before/during/after plugging a slave device in (until data starts). It's also simpler with less data needing to be sent (lower error rates at x errors per million bits, etc).

    Asynch TTL USART serial is simpler and better still, only needing one wire (or two IF you need bidirectional data) and being a fixed baudrate can be low pass RC filtered through a schmidt trigger, to even give total immunity to things like high speed digital noise and dropout noise from bad connections etc.

    Sure you could make I2C work for plug n play ammo clips but I still think async TTL USART serial is a far better choice, assuming only small amounts of data need to be sent.
     
  16. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    There is simply no inherent reason I2C could not do plug and play. There is nothing critical about the protocol, and each and every transaction is limited to a single well defined byte of data, and that byte is always marked with an acknowledge signal. That means if someone unplugs in the middle you will know it soon enough.

    With no limits on clock rates you can run this slow to extend the range. Transceiver amplifiers (self-sensing bidirectional buffers) are available to clean up signals if you have a long signal path; these can also do level translations if the power supply voltage doesn't match between sections.

    The worst that I've even seen happen is a slave will stall during an ACK on the data line (forcing it low), but that isn't an issue when UNPLUGGING a device, and can be fixed just by sending some extra clock signals.

    There are many other equally workable solutions, but the best one here is the one you already built: I2C.
     
  17. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Hi ErnieM, the O.P. said;

    I think if he has used a single USART serial wire, with the clip sending one byte (remaining ammo capacity) he would not be struggling with these problems.

    Code would be extremely simple, ie just check the PIC USART if a byte had been received, then that byte tells the ammo capacity. The clip can just send that byte a few times a second. Error checking is as simple as reading 2 or 3 same values in a row means data is good.

    Besides the code benefits there are hardware benefits in that it only needs a single comms wire and can tolerate noise issues much better.

    So you can say "equally workable solutions" if you like, but they are NOT equally workable. I2C is a poorer choice for plug and play and has a lot of issues. It was developed by Philips to use in chip to chip comms within a single appliance, being worse than many other systems but has an advantage of multiple devices on the same 2-wire bus.

    We don't even know if the O.P. is making use of that ONE advantage, he's definitely coming up against ALL of I2C's disadvantages. :)
     
  18. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    732
    199
    Hi THE_RB

    I have two EEPROMS on the bus. Address 001 is sound data so when the trigger is pressed it is accessed to generate the gunshot and the clip is on address 000. This means I can use both on the same bus with the onboard PIC I2C Module (MSSP module).

    USART sounds good but im unfamiliar with any memory chips using this method. As of now i have a work around. I have an external 4013 as the "Been shot" flag and if the PIC stalls and crashes the watchdog timer resets the pic. Now the pic tests the external flip flop to see if the player was previously hit.
     
  19. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Mitch: Look, if you want you can toss most of your existing work out the window and follow suggestions to enormously complicate your clip module from a simple EEPROM to an EEPROM, controller and probably a mess of other things, plus rewrite out much of your existing code, well, you go right ahead and do that.

    There is absolutely no reason something on the I2C bus could stall your processor, assuming the signals are in some reasonable nominal range. So if you are not sending in large glitch signals that upset the power supply it's not strictly an I2C issue. The statements to the contrary gave no supporting facts, just a (seemingly biased) opinion along with other disparaging terms.

    An oscilloscope would be incredibly helpful here to observe the connection event so you can see if anything unexpected happens.

    Using the watchdog to recover is ok (and should be there) but if this was my work I'd get the plug/unplug not to depend on the watchdog.

    How sure are you of your power supply when you plug in? You do have bypass caps about your chips, correct?

    Some isolation resistors may be useful here; 100 ohms in series with power (followed by bypass cap on EEPROM side), and then 100 ohms in series with the I2C lines.

    Is there any arrangement to get power to the EEPROM before the bus connects? That's what USB does to power the remote device befor it connects to the computer.
     
  20. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I see that as a potential source of problems. If you get mud/dirt/noise/static/spikes etc on your removable clip contacts they are shared totally, those two wires in parallel with your critical sound memory EEPROM! What if a clip is faulty (shorted?).

    Myself and ErnieM obviously have different design philosophies, but my personal preference would be for the plug'n'play clip to use a separate sytem optimised for its reliability, and the sound playback system separate to the potentially problematic clip connections and optimised for its own reliability.

    Re using EEPROMs in the clips, I suggested before maybe going to a tiny cheap PIC like a 10F series. That can output any signal you like, BUT can also offer performance features like clips that slowly recharge their capacity over time (mimicing some games and SciFi standards).
     
Loading...