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.

TMS320C6748 and TSC2046

Other Parts Discussed in Thread: TSC2046, TMS320C6748

HI,

I am using TMS320C6748 and TSC2046. both connected through SPI1. do you have any sample code for communicating both. i ma pretty confused that, your receive API is not asking for any input. as per the datasheet of tsc2046, first master have to transmit an 8 bit to initiate the conversion and send back the data. please help me 

Thanks

Vinay

  • Hi Vinay,
    Have you installed C6748 starterware package ?
    We have sample code for SPI finger print sensor and you can use this code as reference for your further development.
    Almost it has sending commands to SPI slave device like what you expect to do with SPI touch screen device.

    processors.wiki.ti.com/.../StarterWare

    software-dl.ti.com/.../index_FDS.html
  • hi,

    Thanks for your reply.

    now i have initialised the SPI1. when i observed the signals, except CS0, all are coming. why it is so?

    Thanks
    Vinay
  • Hi Vinay,
    Have you modified the code as per your requirement or simply running without modifying ?
    Which CS has been connected to your SPI slave (TSC2046) hardware ?
    If CS0 then have you modified like this ?
    SPI1CSPinMuxSetup(0);
  • Yes.

    part of spi code is shown below

    static void SPIInitialize(void)
    {
    PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_SPI1, PSC_POWERDOMAIN_ALWAYS_ON,
    PSC_MDCTL_NEXT_ENABLE);

    /* Using SPI1 instance. */
    SPIPinMuxSetup(1);

    /* Select CS0 of SPI1. The SPI Flash is connected to SPI1_SCS[0]. */
    SPI1CSPinMuxSetup(0);

    SPISetUp();
    }

    static void SPISetUp(void)
    {
    unsigned char dcs = 0x04;
    unsigned int val = SIMO_SOMI_CLK_CS;

    /* Resets the SPI */
    SPIReset(SOC_SPI_1_REGS);

    /* Brings SPI Out-of-Reset */
    SPIOutOfReset(SOC_SPI_1_REGS);

    /* Configures SPI in Master Mode */
    SPIModeConfigure(SOC_SPI_1_REGS, SPI_MASTER_MODE);

    /* Sets SPI Controller for 4-pin Mode with Chip Select */
    SPIPinControl(SOC_SPI_1_REGS, 0, 0, &val);

    /* Configures the Prescale bit in Data Format register. */
    SPIClkConfigure(SOC_SPI_1_REGS, 24000000, 240,
    SPI_DATA_FORMAT0);

    /* Chip Select Default Pattern is Set To 1 in SPIDEF Register*/
    SPIDefaultCSSet(SOC_SPI_1_REGS, dcs);

    SPIDat1Config(SOC_SPI_1_REGS,SPI_DATA_FORMAT0,0);

    /* Configures SPI Data Format Register */
    SPIConfigDataFmtReg(SPI_DATA_FORMAT0);
    }

    static void SPIConfigDataFmtReg(unsigned int dataFormat)
    {
    SPIConfigClkFormat(SOC_SPI_1_REGS,
    (SPI_CLK_POL_LOW | SPI_CLK_INPHASE),
    dataFormat);

    /* Configures SPI to transmit MSB bit First during data transfer */
    SPIShiftMsbFirst(SOC_SPI_1_REGS, dataFormat);

    /* Sets the Charcter length */
    SPICharLengthSet(SOC_SPI_1_REGS, CHAR_LENGTH, dataFormat);
    }
  • Try to debug your code, especially for the following lines of code.
    I think, the following code could assert the SPI CS pin.
    "SPIDat1Config(SOC_SPI_1_REGS,(SPI_CSHOLD | SPI_DATA_FORMAT0), 0x4);"

    Also the following code could deassert the SPI CS pin.
    "SPIDat1Config(SOC_SPI_1_REGS,SPI_DATA_FORMAT0, 0x4);"

    SPI CS pin must be asserted when you start the SPI transfer and CS should be deasserted when you stop the SPI transfer.