Other Parts Discussed in Thread: HALCOGEN,
Tool/software: Code Composer Studio
could anyone help me in getting device id value which is 0xD7 from WHO_AM_I register
my halcogen configurations are enabled the SPI1 driver , check clock polarity (1)and clock phase (0) and SPI frequency is 10 MHz. (Baudrate set to 300K HZ) with charlen 8 (as device id should be only 8 bits) ,In SPI1 Port i enabled each (SIMO[0],SOMI[0],CLK and (SCS[0] ) as SPI and the others as GIO ) then i generated the code
in my code i received 0xFF and the oscilloscope shows SDO is always high ,i don't know why
#include "sys_common.h" /* USER CODE BEGIN (1) */ #include "spi.h" /* USER CODE BEGIN (2) */ uint16 TX_Data_Master[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint16 RX_Data_Master[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; int main(void) { /* USER CODE BEGIN (3) */ spiDAT1_t dataconfig1_t; // The chip select signal is held continuously active during several consecutive data word transfers dataconfig1_t.CS_HOLD = TRUE; /* After a transaction, WDELAY of the corresponding data format will be loaded into the delay counter. No transaction will be performed until the WDELAY counter overflows. The SPISCS pins will be deactivated for at least (WDELAY + 2) * VCLK_Period duration. */ dataconfig1_t.WDEL = TRUE; // Data word format 0 is selected dataconfig1_t.DFSEL = SPI_FMT_0; // Chip select number. CSNR defines the chip-select that will be activated during the data transfer (0 in our case). dataconfig1_t.CSNR = 0xFE; spiInit(); while(1) { TX_Data_Master[0] =0x80|0x0F; //0x8F who_am_i address spiTransmitAndReceiveData(spiREG1, &dataconfig1_t, 2, TX_Data_Master, RX_Data_Master); printf("Device ID = %x\r\n",RX_Data_Master[1]); } }