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.

LAUNCHXL-F280025C: "error #20: identifier "uint8_t" is undefined"

Part Number: LAUNCHXL-F280025C
Other Parts Discussed in Thread: C2000WARE

Hi,

Is there a way to define 8-bit integers in CCS? Declaring uint16_t and uint32_t works but uint8_t throws up the error "error #20: identifier "uint8_t" is undefined". Here's the code I'm using:

#include "time.h"
#include "stdio.h"
#include "device.h"
#include "stdint.h"

int send_spi_singlebyte(uint8_t code11, uint16_t code12, uint16_t temp, int noSPIresponse, int loopcounter) {//113 018

    if (loopcounter >0){
        return 0;
    }
    else{

        SPI_writeDataBlockingFIFO(mySPI0_BASE, code11);
        SPI_writeDataBlockingFIFO(mySPI0_BASE, code12);
        SPI_writeDataBlockingFIFO(mySPI0_BASE, temp);
        int counter2 = 0;
        return noSPIresponse++;
    }
}

I saw that in _stdint.h and _types.h uint8_t is excluded. Is this because the MCU is 16 bit?

C2000ware version 4.01

Regards,

MZivcec

  • MZivcec,

    The C28x compiler does not supply the type uint8_t.  In case of C28x,  uint8_t and char are 16-bit numbers.

    Please see if the article Byte Accesses with the C28x CPU is useful.

    Best Regards

    Siddharth

  • Hi Siddarth,

    Thanks for the link to the article. I tried using __byte and the SPI transmit was behaving the same as before with uint16_t, with no data showing up on MOSI when SPI is 8 bits wide. Although I found a workaround:

    1. Set SPI to 8 bits wide
    2. Multiply your 16-bit integer by 256 (e.g. if you want to send the value '11', 11*256 = 2816)
    3. Transmit this integer through SPI

    This transmits your initial value '11' in binary through SPI, since the F280025C cuts off the 8 least significant bits of your integer when set to 8-bit SPI length.

    i.e. 11 in binary is '00001011', 11*256 in binary is '00001011 00000000'. Since the board ignores the second byte, only 00001011 is transmitted. Hope this helps others looking for a solution.

    Regards,

    Michael