2 Replies Latest reply on Aug 26, 2013 1:46 PM by user_1377889

    PSoC1 debug problem

    user_2432504

       Hi,

         

       

         

      I'm facing a strange behavior on debug sessions using an Ice Cube with a 29xxx pod, targetting an SSOP-28 CY8C29466 chip.

         

      During initialisation Port0 is fully switched in input mode : each Port0 IO pin declared as STDCPU + High Z, interrup mode set to high (detection of a low-to-high transition).

         

      Before enabling the GPIO interrup mask, the port is firstly read and saved, then  port0 GPIO block interrupts are enabled as shown in the following snippet:

         

      ...

         

          M8C_ClearWDTAndSleep;                                                       // Raz le Sleep Timer pour partir du bon pied ...

         

          M8C_EnableIntMask(INT_MSK0, INT_MSK0_SLEEP);                                // ... et l'autoriser à générer des interruptions

         

          M8C_EnableGInt;

         

          gbbInitFlag = FALSE;

         

          gbINValeurPrecedente = PRT0DR;

         

          PRT0IE = 0xFF;

         

          M8C_EnableIntMask(INT_MSK0, INT_MSK0_GPIO);

         

       

         

      //    SETnDEC_TEMPO(100);

         

       

         

      while (FOREVER)

         

          {

         

              bCtr++;

         

          }

         

      ...

         

      This leads to the following assembly listing after compilation:

         

      (0237)     M8C_EnableGInt;

         

          0B3C: 71 01    OR    F,0x1

         

      (0238)     gbbInitFlag = FALSE;

         

          0B3E: 62 D0 00 MOV   REG[0xD0],0x0

         

          0B41: 55 83 00 MOV   [gbbInitFlag],0x0

         

      (0239)     gbINValeurPrecedente = PRT0DR;

         

          0B44: 5D 00    MOV   A,REG[0x0]

         

          0B46: 53 76    MOV   [gbINValeurPrecedente],A

         

      (0240) PRT0IE = 0xFF;

         

          0B48: 62 01 FF MOV   REG[0x1],0xFF

         

      (0241)     M8C_EnableIntMask(INT_MSK0, INT_MSK0_GPIO);

         

          0B4B: 43 E0 20 OR    REG[0xE0],0x20

         

          0B4E: 80 03    JMP   0x0B52

         

      (0242) 

         

      (0243) //    SETnDEC_TEMPO(100);

         

      (0244)     

         

      (0245)     while (FOREVER)

         

      (0246)     {

         

      (0247)         bCtr++;

         

          0B50: 77 01    INC   [X+1]

         

      (0248)     }

         

          0B52: 8F FD    JMP   0x0B50

         

      When I put a breakpoint at @0B48, I get the following information (see attached file, snapshots 1 & 2):

         
            
      • Port0 correctly interpreted and read as 0x00 (Memory window, IO Bank0 tag),
      •     
      • A reg wrongly carrying value 0x0x7E (should be content of Port0,
      •     
      • Global variable set with the same wrong value (Watch window).
      •     
      •  
      •    
         

       

         

      However, if I put a BP at @0B44 and perform assembly steps everything is correctly carried out (snapshots 3, 4 & 5).

         

       

         

      So what's going wrong? Bad intitialisation, 29xxx pod out of order, or Ice Cube discrepancy? 

         

       I've tested on 2 differents PCs XP and W7), same results.