AM2732-Q1: MSS_MIBSPIB controller project does not run correctly in system project

Part Number: AM2732-Q1
Other Parts Discussed in Thread: AM2732, SYSCONFIG

Hello,

I have implemented a MSS_MIBSPIB Controller freertos project on a R5-0 processor on a AM2732 device.
My code runs correctly without any error. The main code is shown below:

void spi_master(void *args)
{
    int32_t             transferOK;

    Drivers_open();
    Board_driversOpen();

    transferOK = spi_enable_tx_interrupt(gMibspiHandle[SPI_TX]);
    if((SystemP_SUCCESS != transferOK))
    {
        DebugP_assert(FALSE); /* MIBSPI transfer failed!! */
    }

    while(1){;}

}

int32_t spi_enable_tx_interrupt(MIBSPI_Handle handle){

    static MIBSPI_Transaction  spiTransaction;
    static int32_t             status;

    uint16_t enable_tx_interrupt[5]= {0x1008, 0x44A1, 0x0000, 0x0000, 0x0001};

    CacheP_wbInv((void*)enable_tx_interrupt, sizeof(enable_tx_interrupt), CacheP_TYPE_ALLD);

    /* Initiate transfer */
    spiTransaction.count        = sizeof(enable_tx_interrupt);
    spiTransaction.txBuf        = (void *)enable_tx_interrupt;
    spiTransaction.rxBuf        = NULL;
    spiTransaction.peripheralIndex   = 0U;
    spiTransaction.arg          = NULL;

    status = MIBSPI_transfer(handle, &spiTransaction);

    return status;

}

The syscfg is shown below:
image.pngimage.png

When I try to transfer the exact same code and syscfg options to a freertos system project to the exact same R5-0 processor, the project does not run correctly. To be exact the MIBSPI_transfer function fails.

After a lot of debugging inside the MIBSPI_transfer function I see that in the freertos system project it seems that the icount option is NOT enabled and in the freertos R5-0 project is ENABLED. But that makes no sense since there is no icount option when SPI is configured as a Controller and moreover I put by hand the exact same configurations in syscfg in the 2 projects. This difference with icount option has as a result to run different parts of the driver code and end up to failure.

Why is that happening?

  • Hi,

    This thread has been assigned to the correct expert.

    BR Vaibhav

  • Hi Dimitra,

    I am a little bit confused here. The system project is only a container for multiple CCS projects each runs on a different core. Therefore it does not has its own code or syscfg file. 

    System project is main used for multicore applications where  R5 cores and DSP core are used at the same time. It helps to check resource conflict and such.

    In your use case, if you only use one core R5F0_0, then there is no benefit to use system project.

    Best regards,

    Ming

  • Hi Ming,

    I am also using the rest of the processors to do some other things, which is irrelevant to this thread.

    Please focus on my main issue here, which is iCountSupport existence in the sysconfig on the standalone R5_0 project and INEXISTENCE in the system project. It looks like a bug in your tool.

    Why does that happen?

    Best regards,

    Dimitra

    • Hi Dimitra,

    The iCount is used for multiple buffer feature of MIBSPI only. When you use MIBSPI as standard SPI, it should be greyed out. Let me check the syscfg tool for AM273x and get back to you on this issue.

    Best regards, 

    Ming

  • Hi Dimitra,

    The syscfg tool for AM273x only provides the "Enable Multi ICount Support" option for the block mode (not for the callback mode). Again it has nothing to do the system project. It is only related to the syscfg file associate with the CCS project for the specific core (R5F cores or the DSP core).

    Best regards,

    Ming

  • Hi Ming,

    I think you are missing the point here. Let me elaborate this further to you so that we are aligned.

    Inside CCS 20.4.0, we import the R5_0 empty FreeRTOS project. Inside the example.syscfg file of that standalone project we add one instance of the MIBSPI and configure it with some parameters in callback mode as Dimitra showed in the screenshots above. There is no option for iCount inside the graphical interface. However in the background if we open the .syscfg file with the built in Text Editor inside CCS we see iCountSupport = TRUE.

    Everything works the way we want it when we are in standalone project.

    Now we remove that R5_0 STANDALONE project and we import the SYSTEM FreeRTOS project inside CCS 20.4.0. Once again we open the example.syscfg of the R5_0 of the SYSTEM FreeRTOS project and we configure the EXACT SAME SETTINGS as in the STANDALONE project.

    The driver now doesn't work as expected. If we now edit the example.syscfg file with the built-in Text Editor of CCS we do no longer see this line saying iCountSupport = TRUE. And that is very strange.

    To sum up and leave no room for misunderstanding, when a standalone project is loaded and MIBSPI is added and configured in callback mode, the iCountSupport is generated and set to TRUE inside the .syscfg file, while that does not happen if we repeat the exact same process for the exact same processor and MIBSPI settings inside a system project.

    Best regards,

    Konstantinos

  • Hi Konstantinos,

    I did the same thing Dimitra did with the AM273x FreeRTOS SDK 11.02.00.25, I find no difference is the generated the files, especially the iCount related support:

    I did notice the following discrepancy between the MIBSPI example and the empty example on R5F_0_0:

    XBar Instance 
    SPI Instance 

    can be different when you add a new MIBSPI instance in the empty project. 

    Can you tell me which SDK version you have done your experiments?

    Best regards,

    Ming

  • Hi Ming,

    We are using 11.02.00.25 and CCS 20.4.

    I noticed you are using CCS 12.7 which in my opinion could also be the culprit.

    Best regards,

    Konstantinos

  • Hi Konstantinos,

    The CCS version has nothing to do with the syscfg. It is the version of the SysConfig version matters:

    I am using the SysConfig 1.25.0 as suggested by the AM273x FreeRTOS SDK 11.02.00.25 release notes:

    Best regards,

    Ming