2024-04-23 03:26 PM
Im currently working on a custom PCB with cc1120 as transceiver and stm32f446RET6 as MCU. I integrate the cc1120 library from IT's library. The device uses SPI as serial communication. Here is the communication example in given datasheet.
With this information i configured the SPI settings as:
after that i use HAL_SPI_TransmitRecieve( ) function as my comm func. in driver. But im not gonna share the complex library instead i will demonstrate the situation. My CS pin and cc1120 reset pin is logic HIGH in idle by software.
txdata[0] = 0x30;
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 0);
HAL_SPI_TransmitReceive(&hspi1, txdata, rxdata, 1, 500);
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 1);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
txdata[0] = 0x2F;
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 0);
HAL_SPI_TransmitReceive(&hspi1, txdata, rxdata, 1, 500);
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 1);
HAL_Delay(20);
txdata[0] = 0x8F;
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 0);
HAL_SPI_TransmitReceive(&hspi1, txdata, rxdata, 1, 500);
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 1);
HAL_Delay(20);
txdata[0] = 0x00;
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 0);
HAL_SPI_TransmitReceive(&hspi1, txdata, rxdata, 1, 500);
HAL_GPIO_WritePin(SPI1_CS_GPIO_Port, SPI1_CS_Pin, 1);
HAL_Delay(20);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
In this code first i use command SRES (0x30) for reset the device. In this situation device must be send chip status from MISO line when i start to transmit from MOSI line. But i cant see the chip status byte in MOSI line (Im seeing 0xFF as chip status byte). Chip status byte explained in datasheet as: "When the header byte, data byte, or command strobe is sent on the SPI interface, the chip status byte is sent by the CC112X on the SO pin." and:
Then in while loop , want to access PART NUMBER register for read the chip id. The chip id reg is a extended register (0x2F8F). So first im transmitting 0x2F then 0x8F after that i want to recieve chip id. But again i cant get anything.
So i cant reach the cc1120 device but i don't know why. I tried several different configurations. I use oscilloscope for see the lines and SCK line looks fine to me. Here is the MCU and the RF part of pcb. Almost same as the reference design of the cc1120:
So there is a external 32MHz oscillator indicated as Y2 but we don't have it so we use 32.578 MHz instead. Is that a problem for the device? Here is the scope results:
Ch1:SCK
CH2:MOSI
In MISO line im only seeing logic HIGH voltage and nothing else. I think that MOSI line scope results overlapping in while loop but im not sure. How can i solve this problem?
Solved! Go to Solution.
2024-04-24 10:44 AM - edited 2024-04-24 10:44 AM
My settings are same as yours. Which library are you using for the device?
2024-04-25 02:47 AM - edited 2024-04-25 03:00 AM
I worked from the SWRA493 (October 2015) CC112x-CC1190 Boost Software Examples:
https://www.ti.com/tool/BOOSTXL-CC1120-90#related-design-resources
https://www.ti.com/lit/an/swra493/swra493.pdf
Another advantage of starting with a manufacturer's dev kit!
Your other 2 threads have already pointed-out two flaws in your code:
and that's apart from any hardware issues on your custom board.
2024-04-25 02:58 AM - edited 2024-04-25 03:09 AM
At the moment, I do not have the budget to purchase a development kit. I have noticed that the SO line never goes low, which I have already pointed out in the scope results. I am wondering if there are any flaws you can identify in my design.
2024-04-25 03:05 AM
@mrkayaalp wrote:I have identified an issue with my current custom PCB,
Please be sure to update both your other threads with this key information!
@mrkayaalp wrote:I have noticed that the SO line never goes low
As previously noted, that could be due to the GND pad not properly connected:
@mrkayaalp wrote:I am wondering if there are any flaws you can identify in my design.
That's really a question for the TI forum - nothing to do with ST.
2024-04-25 03:15 AM
I expressed myself incorrectly; let me edit my reply for clarity.
2024-04-25 03:26 AM - edited 2024-04-25 03:32 AM
Probably better to post a new clarified reply rather than edit an existing post - especially when that post already has replies to it as originally written.
2024-04-25 03:31 AM
@mrkayaalp wrote:I do not have the budget to purchase a development kit. .
Maybe look at 3rd-party modules?
eg, https://www.aliexpress.com/i/32827512831.html - although, of course, the quality can be questionable ...
2024-04-26 03:37 PM
We solved the problem. We were using a 32.768 MHz instead of 32 MHz oscillator. When we soldered 32 MHz, one SO line pulled logic LOW when CS was asserted.