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.
Hello TI
We try to integrate MCAL SPI Driver (Version 08.06.02) into our basic SW project.
We did some experiment with the driver and we saw that the SPI is always in LOOPBACK Mode. We cannot change the mode.
Here is the configuration of the SPI driver:
SPI RECEPTION = Data[0] // SPI_PIN_D0 this is for Data Reception
SPI TRANSMISSION = Data[1] // SPI_PIN_D1 this is for Data Transmission
Here is an example:
we send data 0xAA
This is the result
The Data's are correct send; but we always receive the same data's at the same time. The send and receive pins are not same and are not connected together.
Why is there a loopback on the SPI driver? We shouldn't have MISO_DO; because we don't have slave on the other side.
Here is also a related code part :
If we comment this code part, it has no influence.
I think it is a small bug in the driver; but we need a fast fix for our development.
I would be appreciated, if this issue could be handled as soon as possible.
Thank you
best regards.
Hi,
I'm looking into this issue and will get back by Tuesday EOD as I need some time to check with the SPI owner on this.
Thanks
Hi,
Which SPI instance are you using? Can you please share the entire SPI configuration? If I understood correctly, you have not connected any slave but still see data in D0?
Thanks And Regards,
Sunil Kumar M S
Hi Sunil,
The enitre SPI cfg is attached:
/* * * Copyright (c) 2022 Texas Instruments Incorporated * * All rights reserved not granted herein. * * Limited License. * * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive * license under copyrights and patents it now or hereafter owns or controls to make, * have made, use, import, offer to sell and sell ("Utilize") this software subject to the * terms herein. With respect to the foregoing patent license, such license is granted * solely to the extent that any such patent is necessary to Utilize the software alone. * The patent license shall not apply to any combinations which include this software, * other than combinations with devices manufactured by or for TI ("TI Devices"). * No hardware patent is licensed hereunder. * * Redistributions must preserve existing copyright notices and reproduce this license * (including the above copyright notice and the disclaimer and (if applicable) source * code license limitations below) in the documentation and/or other materials provided * with the distribution * * Redistribution and use in binary form, without modification, are permitted provided * that the following conditions are met: * * * No reverse engineering, decompilation, or disassembly of this software is * permitted with respect to any software provided in binary form. * * * any redistribution and use are licensed by TI for use only with TI Devices. * * * Nothing shall obligate TI to provide you with source code for the software * licensed and provided to you in object code. * * If software source code is provided to you, modification and redistribution of the * source code are permitted provided that the following conditions are met: * * * any redistribution and use of the source code, including any resulting derivative * works, are licensed by TI for use only with TI Devices. * * * any redistribution and use of any object code compiled from the source code * and any resulting derivative works, are licensed by TI for use only with TI Devices. * * Neither the name of Texas Instruments Incorporated nor the names of its suppliers * * may be used to endorse or promote products derived from this software without * specific prior written permission. * * DISCLAIMER. * * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ /** * \file Spi_PBcfg.c * * \brief This file contains generated post build configuration file * for SPI MCAL driver */ /***************************************************************************** Project: AM263x_Release_090 Date : 2022-08-19 22:43:27 This file is generated by EB Tresos Do not modify this file, otherwise the software may behave in unexpected way ******************************************************************************/ /******************************************************************************* * INCLUDES ******************************************************************************/ #include "Spi.h" #include "Spi_Irq.h" /******************************************************************************* * VERSION CHECK ******************************************************************************/ #if ((SPI_SW_MAJOR_VERSION != (8U)) || (SPI_SW_MINOR_VERSION != (6U))) #error "Version numbers of Spi_PBcfg.c and Spi.h are inconsistent!" #endif /******************************************************************************* * LOCAL CONSTANT MACROS ******************************************************************************/ /******************************************************************************* * LOCAL FUNCTION MACROS ******************************************************************************/ /******************************************************************************* * LOCAL DATA TYPES AND STRUCTURES ******************************************************************************/ /******************************************************************************* * LOCAL DATA PROTOTYPES ******************************************************************************/ /******************************************************************************* * GLOBAL DATA ******************************************************************************/ #define SPI_START_SEC_CONFIG_DATA #include "Spi_MemMap.h" /* generation of runtime configuration */ #ifdef __cplusplus extern "C" { #endif static void SpiApp_McspiJob0EndNotification(void); static void SpiApp_McspiJob1EndNotification(void); static void SpiApp_McspiJob2EndNotification(void); static void SpiApp_McspiJob3EndNotification(void); static void SpiApp_McspiSeq0EndNotification(void); static void SpiApp_McspiSeq1EndNotification(void); static void SpiApp_McspiSeq2EndNotification(void); static void SpiApp_McspiSeq3EndNotification(void); volatile uint32 gSpiApp_McspiJobDone[SPI_MAX_JOBS +1]; volatile uint32 gSpiApp_McspiSeqDone[SPI_MAX_SEQ +1]; CONST(struct Spi_ConfigType_s, SPI_CONFIG_DATA) Spi_Config = { .maxChannels = 1U, .maxJobs = 1U, .maxSeq = 1U, .maxHwUnit = 2U, .maxExtDevCfg = 2U, .channelCfg = { [0] = { .channelBufType = SPI_EB, .dataWidth = 8u, /*8 Word Length*/ .defaultTxData = 0u, .maxBufLength = 100u, .transferType = SPI_MSB, } }, .jobCfg = { [0] = { .jobPriority = SPI_JOB_PRIORITY_0, .hwUnitId = SPI_UNIT_MCSPI1, .Spi_JobEndNotification = SpiApp_McspiJob0EndNotification, .channelPerJob = 1U, .channelList = { [0] = 0U, }, }, }, .seqCfg = { [0] = { .seqInterruptible = (uint8) TRUE, .Spi_SequenceEndNotification = SpiApp_McspiSeq0EndNotification, .jobPerSeq = 1U, .jobList = { 0U, }, // .jobId = 0u, // .csPin = SPI_CS0, // .externalDeviceCfgId = 1u /*IMPORTANT*/ }, }, .hwUnitCfg = { [0] = { .hwUnitId = SPI_UNIT_MCSPI0, .enabledmaMode = (boolean)FALSE, .dmaTxChIntrNum = 0, .dmaRxChIntrNum = 0, }, [1] = { .hwUnitId = SPI_UNIT_MCSPI1, .enabledmaMode = (boolean)FALSE, .dmaTxChIntrNum = 0, .dmaRxChIntrNum = 0, } }, .extDevCfg = { [0] = /*HW UNIT 0 - SPI 0*/ { .mcspi = { .csEnable = (uint16) TRUE, .csMode = SPI_CONTINUOUS, .csPolarity = SPI_LOW, .csIdleTime = SPI_DATADELAY_0, .clkDivider = 11U, /* 0 = Default clock divider - clock is 48MHz */ .clkMode = SPI_CLK_MODE_0, .txRxMode = SPI_TX_RX_MODE_BOTH, .startBitEnable = (uint16) FALSE, .startBitLevel = SPI_LOW, .receptionLineEnable = DATA_LINE_0_RECEPTION, /* D0 = MISO */ .transmissionLineEnable = DATA_LINE_1_TRANSMISSION, /* D1 = MOSI */ }, }, [1] = /*HW UNIT 1 - SPI 1*/ { .mcspi = { .csEnable = (uint16) TRUE, .csMode = SPI_CONTINUOUS, .csPolarity = SPI_LOW, .csIdleTime = SPI_DATADELAY_0, .clkDivider = 11U, /* 0 = Default clock divider - clock is 48MHz */ .clkMode = SPI_CLK_MODE_0, .txRxMode = SPI_TX_RX_MODE_BOTH, .startBitEnable = (uint16) FALSE, .startBitLevel = SPI_LOW, .receptionLineEnable = DATA_LINE_0_RECEPTION, /* D0 = MISO */ .transmissionLineEnable = DATA_LINE_1_TRANSMISSION, /* D1 = MOSI */ }, }, }, }; CONST(Spi_ChannelConfigType_PC, SPI_CONFIG_DATA) Spi_ChannelConfig_PC[] = { [0] = { .channelId = SpiConf_SpiChannel_SpiChannel_0, } }; CONST(Spi_JobConfigType_PC, SPI_CONFIG_DATA) Spi_JobConfig_PC[] = { [0] = { .jobId = SpiConf_SpiJob_SpiJob_0, .csPin = SpiConf_SpiExternalDevice_CS0, .externalDeviceCfgId = (uint8)1U, /*HW UNIT 1 - SPI 1*//*IMPORTANT*//*IMPORTANT*//*IMPORTANT*//*IMPORTANT*//*IMPORTANT*/ }, }; CONST(Spi_SeqConfigType_PC, SPI_CONFIG_DATA) Spi_SeqConfig_PC[] = { [0] = { .seqId = SpiConf_SpiSequence_SpiSequence_0, }, }; static void SpiApp_McspiJob0EndNotification(void) { gSpiApp_McspiJobDone[0U] = TRUE; return; } static void SpiApp_McspiJob1EndNotification(void) { gSpiApp_McspiJobDone[1U] = TRUE; return; } static void SpiApp_McspiJob2EndNotification(void) { gSpiApp_McspiJobDone[2U] = TRUE; return; } static void SpiApp_McspiJob3EndNotification(void) { gSpiApp_McspiJobDone[3U] = TRUE; return; } static void SpiApp_McspiSeq0EndNotification(void) { gSpiApp_McspiSeqDone[0U] = TRUE; return; } static void SpiApp_McspiSeq1EndNotification(void) { gSpiApp_McspiSeqDone[1U] = TRUE; return; } static void SpiApp_McspiSeq2EndNotification(void) { gSpiApp_McspiSeqDone[2U] = TRUE; return; } static void SpiApp_McspiSeq3EndNotification(void) { gSpiApp_McspiSeqDone[3U] = TRUE; return; } /** * \brief This type defines a range of HW SPI Hardware microcontroller * peripheral allocated to this Job */ const uint32 Spi_HwUnitBaseAddr[SPI_HW_UNIT_CNT] = { 0x52200000 , /* MCSPI0 */ 0x52201000 , /* MCSPI1 */ 0x52202000 , /* MCSPI2 */ 0x52203000 , /* MCSPI3 */ 0x52204000 /* MCSPI4 */ }; #ifdef __cplusplus } #endif #define SPI_STOP_SEC_CONFIG_DATA #include "Spi_MemMap.h" #define SPI_START_SEC_ISR_CODE #include "Spi_MemMap.h" /** * \brief SPI Hwunit ISR */ /** \brief SPI MCSPI0 ISR */ __attribute__((target("arm"))) FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcspi0TxRx(void) { Spi_IntISR_McspiTxRx(SPI_UNIT_MCSPI0); } /** \brief SPI MCSPI1 ISR */ __attribute__((target("arm"))) FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcspi1TxRx(void) { Spi_IntISR_McspiTxRx(SPI_UNIT_MCSPI1); } /** \brief SPI MCSPI2 ISR */ __attribute__((target("arm"))) FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcspi2TxRx(void) { Spi_IntISR_McspiTxRx(SPI_UNIT_MCSPI2); } /** \brief SPI MCSPI3 ISR */ __attribute__((target("arm"))) FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcspi3TxRx(void) { Spi_IntISR_McspiTxRx(SPI_UNIT_MCSPI3); } /** \brief SPI MCSPI4 ISR */ __attribute__((target("arm"))) FUNC(void, SPI_CODE_FAST) Spi_IrqUnitMcspi4TxRx(void) { Spi_IntISR_McspiTxRx(SPI_UNIT_MCSPI4); } #define SPI_STOP_SEC_ISR_CODE #include "Spi_MemMap.h" /******************************************************************************* * END OF FILE: Spi_PBcfg.c ******************************************************************************/
Yes , I don't connect it to any slaves and I see still Datas in D0.
When I make changes on reception-, transmissioLineEnable, then nothing is changed on the control register of SPI. Any changes on those Lines, have no influence.
The used SPI instance is SPI1.
Best regards.
Hi,
Can you please clarify below? Configuration looks fine.
Please find the configuration attached in which I have configured SPI1 without loopback and could not see any data on D0
/cfs-file/__key/communityserver-discussions-components-files/908/4657.Spi_5F00_PBcfg.c
Thanks And Regards,
Sunil Kumar M S