Post Go back to editing

SPI baudrate and device number?

Hi

Im working on combining the BF52xC1, LCD and touchscreen/keypad driver in VDK.

I have a question about the baudrate and system clock settings. When initialising the touchscreen/keypad the example from ADI sets the SCLK to 133 MHz and SPI clock to 10 MHz.

Will it conflict with the codec on the SPI or?

Also, both the codec and max1233 are using the spi device nr 1, but different spi chip select. Will this conflict?

I should mention that its a BF527 ez-kit rev 1.5 im working on.

Regards

Martin

  • Your error seems to originate from - 'trying to install multiple callbacks for one FLAG ID' & not really related to the SPI Chip select. Call back pertains to that of interrupts and therefore the input condition. You can only define one set of properties for interrupt generation for one flag, at a time. I am not sure if the audio driver code installs any flag interrupt, but the MAX1233 seems to install penirq and keyirq. So if there no mistake in the code, perhaps you need to find out if same FLAG IDs are getting installed with more than 1 callbacks. Maybe looking at adi_flag_InstallCallback() function run time for

    ADI_FLAG_ID might help.

    I saw the following IDs for MAX1233

    #define

    PENIRQ_FLAG_ID ADI_FLAG_PF10 /* PENIRQ signal connected to this Flag */

    #define

    KEYIRQ_FLAG_ID ADI_FLAG_PF9  /* KEYIRQ signal connected to this Flag */\

    -  Prasanth.

  • Hi again.

    The 3 device drivers are now implemented in VDK, but I get the error: "Failed to configure MAX1233 driver: 0x00080004" when initializing the Max1233 device driver. The error should be "All flag slots are in use", but how do I solve it?

    The error is from this line of code:

    adi_dev_Control(MAX1233DriverHandle, ADI_DEV_CMD_TABLE, (void *)MAX1233_BF527_HardwareConfiguration)

    And the HardwareConfiguration is:

    MAX1233_SPI_DEV_NUMBER       1

    MAX1233_SPI_CS                         2

    &SpiBaudRateRegValue (Calculated)

    &PenIrqPort

    &KeyIrqPort

    Any idea?

    Regards

    Martin

  • It doesn't look like an issue caused by VDK interaction. With VDK, the SSL errors are more of interrupt related. I have provided some info here:

    https://ez.analog.com/message/14013#14013

    Regards

    Prasanth.

  • Hi

    Thanks for your answer. The codec uses the following flag id:

    BF52xC1_CSB_PIN     ADI_FLAG_PH9

    So there should not be a conflict.

    I can't really see what should generate the error. I have used the example from ADI to initialize the Max1233 as a device driver in VDK.

    The 3 device drivers are initialized in this order: Max1233 -> Codec -> LCD

    If i change the order to Codec -> LCD -> Max1233, the error disappears, but the project stops in the PPI device driver in the function "adi_test_isr_fail" with the error: DMA error interrupt.

    The LCD initializes and shows the picture, but when it tries to initialize the Max1233 the LCD stops.

    I hope it was understandable. Really hard to explain

    But should I create a interrupt in VDK to handle the two flag interrupts or?

    Theres still a lot about VDK I haven't fully understood

    Regards

    Martin

  • Hi

    I have used the example you provided in the other thread, and implemented the device driver for the touchscreen in it. And thats where I get the error. I can't figure out what I did wrong. But I will try starting from scratch with a clean project and then see whats happening.

    But you should have a big thanks for your help untill now. The example in the other thread was a big help.

    And if you have any solution to my problem here, you are most welcome to post it.

    Regards

    Martin

  • Hi Martin,

    As long as you do not disturb VDK reserved interrupts (see relevant info in VDK Manual), user can install any system interrupt to any 'other IVG'.

    Try debugging with the FLAG Services as I mentioned. For instance, you can insert breakpoints in API adi_flag_InstallCallback() and track the ADI_FLAG_ID parameter whenever this API is called. In VDSP, you have to see the variable FlagID when you within inside this API.

    ADI_FLAG_RESULT adi_flag_InstallCallback(

    // installs a callback for a flag

    ADI_FLAG_ID FlagID,

    .........................

    ........................ )

    {

         ...................................................

         // return if we don't have a space for the callback

          if (!i) {      return

         (ADI_FLAG_RESULT_ALL_IN_USE);

         }

    ...................................................

    }

    FYI, the flag service library is here: C:\Program Files\Analog Devices\VisualDSP 5.0\Blackfin\lib\src\services\flag.

    Regards

    Prasanth.

  • Hi again

    I've now tried to start a clean VDK project and created a device driver for the max1233. The error is still there, so as you said earlier it hadn't anything to do with the chipselect and all that.

    It's still this error: Failed to configure MAX1233 driver: 0x00080004 -> "All flag slots are in use".

    And it appears when i make the hardwareconfiguration from the function "adi_dev_control":

    ADI_DEV_CMD_VALUE_PAIR  MAX1233_BF527_HardwareConfiguration[]=
    {
        // configure Kookaburra pins to talk to the Max
        { ADI_MAX1233_CMD_SET_SPI_DEVICE_NUMBER,       (void *)MAX1233_SPI_DEV_NUMBER  },  /* SPI device to use              */
        { ADI_MAX1233_CMD_SET_SPI_CS,                              (void *)MAX1233_SPI_CS                    },  /* SPI CS for MAX1233             */
        { ADI_MAX1233_CMD_SET_SPI_BAUD,                         (void *)&SpiBaudRateRegValue            },  /* override default SPI baud rate */
        { ADI_MAX1233_CMD_INSTALL_PENIRQ,                      (void *)&PenIrqPort                              },  /* Enable PENIRQ monitoring       */
        { ADI_MAX1233_CMD_INSTALL_KEYIRQ,                      (void *)&KeyIrqPort                              },  /* Enable KEYIRQ Monitoring       */
        { ADI_DEV_CMD_END,                                                 NULL                                                  }   /* Terminate config table         */
    };

    So it is the two PenIrq and Keyirq which are causing the error. But I can't figure out have it should be done in VDK.

    Any help here?

    Regards

    Martin

  • Hi

    Thanks for your feedback. Now I understand what you ment with your earlier post.

    I will try step through the code and see if I can find the error. I will be back with the result.

    Regards

    Martin

  • Hi again

    I've debuged to the point in the adi_flag.c where the error starts. It's in this for loop:

    for (i = adi_flag_InstanceData.NumEntries, pEntry = adi_flag_InstanceData.pCallbacks; i; i--, pEntry++) {

            // IF (entry is free)

            if (pEntry->FlagID == ADI_FLAG_UNDEFINED) {

                // save the FlagID in the callback to indicate it's in use

                pEntry->FlagID = FlagID;

                // exit the loop

                break;

            // ENDIF

            }

        //  ENDFOR

        }

    It never enters the loop, because adi_flag_InstanceData.NumEntries sets i to 0. Any suggestions on how to solve this?

    Regards

    Martin

    ******************************** EDIT ***********************************

    Okay. I've solved the problem. It was of cause a stupid rookie mistake. The Max1233 now initializes correctly, but the callback function isn't called at keypress or touch. Should the callback function stay in the device driver file or moved to a thread to work?

    Regards

    Martin

  • Hi,

    Callbacks run in ISRs and not in thread space. If it is live callback, you can treat it as a function called inside the ISR. If it is deferred callback, execution of this function is further deferred to a lower priority ISR.

    VDK presents its own version of 'deferring of low-priority user-activity'. The concept is called re-schedule ISR, which runs at IVG14, where you can do the same thing as you would do in a deferred SSL callback. I do not know if you can change this level to another IVG, but you can do that with SSL deferred callback, if you call the adi_dcb_open() with the appropriate IVG number.

    Refer to activate & dispatch function in VDK Manual for more info. Also, go through the SS & DD Manual.

    Check the return of each SSL API for non-zero value. Also see the Appendix of VDK manual. You may also insert breakpoints inside ADI_INT_HANDLER() of your driver to see if you ever see an interrupt triggered (first try that without VDk though).

    BTW, what was the mistake you did? Just curious, so that someone who reads this thread might find it useful.

    - Prasanth.

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.