Hi, I'm stuck in my code SPI. It is simply a code that must be able to send a few bites.
When the code reaches "SPI_transfer (spiHandle, & spiTransaction);" it is completely stuck.
I followed the guide to the letter and it should work.
I am using the "CC1350 LaunchPad".
I attached a picture of debug, with a message that I do not understand
I attached the code
/* XDC Module Headers */ #include <xdc/std.h> #include <xdc/runtime/System.h> #include <ti/drivers/SPI.h> /* BIOS Header files */ #include <ti/sysbios/BIOS.h> #include <ti/sysbios/knl/Task.h> #include <ti/drivers/GPIO.h> #include <ti/drivers/SPI.h> /* Example/Board Header files */ #include "Board.h" #include <stdbool.h> bool loop = true; SPI_Handle spiHandle; SPI_Params spiParams; SPI_Transaction spiTransaction; /* Pin driver handles */ static PIN_Handle pinHandle; /* Global memory storage for a PIN_Config table */ static PIN_State pinState; PIN_Config pinTable[] = { Board_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, IOID_30 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, PIN_TERMINATE }; void delay_s(int dly) { while (dly > 0) { __delay_cycles(48000000); dly--; } } void delay_ms(int dly) { while (dly > 0) { __delay_cycles(48000); dly--; } } #define c 0x01 // ======== SETUP ======== void setup(){ System_printf("Start Setup\n"); /* Call board init functions */ Board_initGeneral() ; //BIOS_start(); // to enable interrupts and start the scheduler and kick BIOS into gear. pinHandle = PIN_open(&pinState, pinTable); if (!pinHandle) { System_abort("Error initializing board LED pins\n"); } System_printf("End Setup\n"); } /* * ======== main ======== */ Int main() { setup(); // ======== LOOP ======== while (loop) { PIN_setOutputValue(pinHandle, Board_LED0, 1); delay_ms(2000); PIN_setOutputValue(pinHandle, Board_LED0, 0); delay_ms(2000); uint8_t transmitBuffer[1]; SPI_Params_init(&spiParams); spiParams.transferMode = SPI_MODE_BLOCKING; spiParams.transferTimeout = SPI_WAIT_FOREVER; spiParams.transferCallbackFxn = NULL; spiParams.mode = SPI_MASTER; spiParams.bitRate = 4000000; spiParams.dataSize = 6; spiHandle = SPI_open(0, &spiParams); transmitBuffer[0] = c; spiTransaction.count = 1; spiTransaction.txBuf = transmitBuffer; spiTransaction.rxBuf = NULL; SPI_transfer(spiHandle, &spiTransaction); SPI_close(spiHandle); } BIOS_exit(0); /* terminates program and dumps SysMin output */ return (0); }
