+ Reply to Thread
Results 1 to 5 of 5

Thread: SPI Transmit Problem on XMC4800

  1. #1
    New Member New Member KadirKarson2 is on a distinguished road
    Join Date
    Jan 2018
    Posts
    3
    Points
    30

    SPI Transmit Problem on XMC4800

    Hello all,

    I am new about XMC family. I tried to communicate with my sensor using DAVE apps but When I check signals, transmit signal is false. After that, I tried to communicate use XMC functions but the result is same.

    I attached my output signals and my codes.

    So,how can I solve my problem ?

    XMC_SPI_CH_Init(XMC_SPI1_CH0, &spi_config);
    XMC_SPI_CH_SetInputSource(XMC_SPI1_CH0,XMC_SPI_CH_ INPUT_DIN0,USIC1_C0_DX0_P0_5);


    XMC_GPIO_SetMode(SPI_MOSI, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
    XMC_GPIO_SetMode(SPI_SS, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
    XMC_GPIO_SetMode(SPI_SCLK, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
    XMC_GPIO_SetMode(SPI_MISO, XMC_GPIO_MODE_INPUT_TRISTATE);


    uint16_t readata = 0x85;

    XMC_SPI_CH_Start(XMC_SPI1_CH0);

    while(1U)
    {
    XMC_SPI_CH_EnableSlaveSelect(XMC_SPI1_CH0, XMC_SPI_CH_SLAVE_SELECT_0);

    /*Sending a byte*/
    XMC_SPI_CH_Transmit(XMC_SPI1_CH0,readata, XMC_SPI_CH_MODE_STANDARD);
    /*Wait till the byte has been transmitted*/
    while((XMC_SPI_CH_GetStatusFlag(XMC_SPI1_CH0) & XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION) == 0U)
    {

    }
    XMC_SPI_CH_ClearStatusFlag(XMC_SPI1_CH0, XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION);

    /*Disable Slave Select line */
    XMC_SPI_CH_DisableSlaveSelect(XMC_SPI1_CH0);

    XMC_SPI_CH_EnableSlaveSelect(XMC_SPI1_CH0, XMC_SPI_CH_SLAVE_SELECT_0);



    Here is my code using DAVE Apps.


    uint8_t readata = 0x85;


    uint32_t status1 = 0;
    uint32_t status2 = 0;


    SPI_MASTER_SetMode(&SPI_MASTER_0, XMC_SPI_CH_MODE_STANDARD);


    /* Clear the flags */
    SPI_MASTER_ClearFlag(&SPI_MASTER_0,XMC_SPI_CH_STAT US_FLAG_ALTERNATIVE_RECEIVE_INDICATION);
    SPI_MASTER_ClearFlag(&SPI_MASTER_0,XMC_SPI_CH_STAT US_FLAG_RECEIVE_INDICATION);

    while(1U)
    {

    SPI_MASTER_Transmit(&SPI_MASTER_0,readata,1);
    while(SPI_MASTER_0.runtime->tx_busy);
    /* Wait till dummy data is received from epson sensor */
    do
    {
    status1 = SPI_MASTER_GetFlagStatus(&SPI_MASTER_0,XMC_SPI_CH_ STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION);
    status2 = SPI_MASTER_GetFlagStatus(&SPI_MASTER_0,XMC_SPI_CH_ STATUS_FLAG_RECEIVE_INDICATION);
    } while(((status1 == 0) && (status2 == 0)));

    /* Clear the flags */
    SPI_MASTER_ClearFlag(&SPI_MASTER_0,XMC_SPI_CH_STAT US_FLAG_ALTERNATIVE_RECEIVE_INDICATION);
    SPI_MASTER_ClearFlag(&SPI_MASTER_0,XMC_SPI_CH_STAT US_FLAG_RECEIVE_INDICATION);

  2. #2
    New Member New Member a_serbu is on a distinguished road
    Join Date
    Jan 2017
    Posts
    2
    Points
    25
    I can help you but not based on XMC library functions. Tell me, please, what pins do you use for the SPI interface on XMC4800 and what data frame your sensor needs.

    Cheers,
    Alex

  3. #3
    New Member New Member KadirKarson2 is on a distinguished road
    Join Date
    Jan 2018
    Posts
    3
    Points
    30
    Hello Alex,
    Thank you for your reply
    I use 0.4 0.5 0.6 0.11
    I need to send 8bit data and also read 8 bit data

    My clock cannot be up to 1 mhz to work with sensor.

    Thank You,
    Best Regards.
    Kadir Karson

  4. #4
    Beginner Beginner yangyang_2018 is on a distinguished road
    Join Date
    Mar 2018
    Posts
    7
    Points
    95
    Do you have solved it?

  5. #5
    New Member New Member KadirKarson2 is on a distinguished road
    Join Date
    Jan 2018
    Posts
    3
    Points
    30
    No I still cannot communicate with them

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.