This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3359: Discrepancy between pinmux files and C code

Part Number: AM3359

I am trying to change the pinmux file for my TMDSICE3359 development board to add in McASP functionality (receive only and not for audio).  I've read the documentation for the PDK I am using (currently pdk_am335x_1_0_16) especially this part http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_board.html#am335x-am437x which was referred to in a previous forum thread.  After searching through the makefiles and source code within the PDK I can tell where to put my generated am335x_pinmux_data.c and am335x_pinmux.h files so that they get compiled when building the board library using 

gmake board_lib

I also know to change the pinmux configuration table pointer in icev2AM335x_pinmux.c to reference my new pinmux, as follows:

int32_t PINMUXModuleConfig(chipdbModuleID_t moduleId, uint32_t instNum, 
                                                              void* pParam1)
{
    pinmuxModuleCfg_t* pModuleData = NULL;
    pinmuxPerCfg_t* pInstanceData = NULL;
    volatile pinmuxBoardCfg_t* pPinmuxData = NULL;
    uint32_t ctrlModBase = CHIPDBBaseAddress(CHIPDB_MOD_ID_CONTROL_MODULE, 0);
    int32_t status = E_FAIL;
    uint32_t index = 0;
    
    /* Get module Data */
//  pPinmuxData = gIceV2PinmuxData;
    pPinmuxData = gAM335xPinmuxData;

where gAM335xPinmuxData is the pointer to the new table.

I have used the template icev2_config.pinmux file from folder C:\ti\pdk_am335x_1_0_16\packages\ti\starterware\tools\pinmux_config\am335x with the pinmux tool and added in the McASP pin configuration that I need.  From there I generate the .c and .h files and put them where they are needed as above then rebuild the board library.  In CCS I have a project derived from rtos_template_app_am335x_a8 which happily flashes the RGB LED in the corner of the board.  I recompile the project using the new pinmux configuration and it builds OK.  Then I go to debug the project but I get 

Guessing that I've got the pinmux wrong somehow, I revert the pinmux settings back to their default from the template in the pinmux tool and regenerate the C and H files.  I rebuild the board library and then the application code.  The result is the same, I get the ADP_Stopped exception.  This always happens when trying to step past the Board_init() function.  If I change the pointer to the configuration table back to its original value the code works and the LED flashes.

So, it seems like the pinmux template within the PDK is wrong.  Following on from that assumption, I do a diff between the generated pinmux C file and the original within the PDK (C:\ti\pdk_am335x_1_0_16\packages\ti\starterware\board\am335x\am335x_icev2_pinmux_data.c).  To my surprise they are quite different.  I've attached the diff report for you to see.diff_report.htm

My questions are these:

  1. Am I doing something wrong?
  2. Do you have the pinmux file for the development board that will generate the correct C code?
  3. Is there a way of being able to step into the Board_init() function by building debug board libraries instead of release versions so that I can see where the exception is occurring at a more useful level?

  • Just to add to this, I did a real simple test by copying the contents of am335x_icev2_data.c to am335x_pinmux_data.c and use the gAM335xPinmuxData pointer as before.  After rebuilding the library and application code the board programs and runs just fine.  So I'm more convinced that there is something amiss with the pinmux data.

  • Hi Simon,

    The first thing I would do is to increase the task size and the heap size (simply double them) and then rebuild the application code, because it sounds like the stack is overflowed.

    Ming

  • Hi Ming,

    OK, I haven't tried that but what I have done and is successful is to use the code from ti\starterware\board\am335x\am335x_icev2_pinmux_data.c and merge in the McASP pinmux code generated by the tool.  I have removed the places where the pinmux would conflict.  This builds and debugs OK.

    So I'm not convinced that increasing task and heap size is going to be the answer.  It can't really explain why code generated from the pinmux tool from the given templates for the development kit fails to work.  In any case the exception happens before BIOS_start() is called so there aren't any tasks running.

    Regards,

    Simon

  • Hi Simon,

    1. I agree with you that it is not a problem of stack size.

    2. You can rebuild the board library in debug mode using: "gmake board_lib BUILD_PROFILE=debug"

    3. Can you re-install the Processor SDK RTOS 6.1.0 for AM335x from scratch and then use the icev2_config.pinmux file from folder C:\ti\pdk_am335x_1_0_16\packages\ti\starterware\tools\pinmux_config\am335x with the pinmux tool without any changes? If it still fails, then there is a problem with the template pinmux file. We should report as a bug.

    4. You mentioned in the previous post that you have successfully merged the the McASP pinmux code generated by the tool with ti\starterware\board\am335x\am335x_icev2_pinmux_data.c and build and debugged OK. Does that mean your problem is resolved, except the default pinmux template file does not work?

    Ming

  • Hi Ming,

    Thanks for the rapid response, it's very helpful.

    Thank you also for the tip in rebuilding libraries in debug mode.  I'll try that now.

    For point 3, I have already done this and the result is the same.  I also did a folder diff between different PDK versions (1_0_9 vs 1_0_12 vs 1_0_15 vs 1_0_16) and the pinmux files are all the same.  1_0_9 seems to have a different naming convention on the filenames but the content is the same.  I've also tried the offline pinmux tool and the cloud version - they both end up in the same state.

    For point 4, yes I am now further down the road and I have my updated pinmux settings and my flashing LED!  So yes my problem is resolved bar the exception of the pinmux template, as you suggest.

    Thanks again for your time.

    Regards,

    Simon

  • Hi Simon,

    I am glad to see that your problem is resolved. As we discussed, I will file a bug report against the template pinmux file. Hopefully we will fix this in next release.

    Thank you so much for using TI product and your effort to identify the root cause of the issue.

    Would you mind mark this thread as "Resolved"

    Ming