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.

[参考译文] CC1125:无法读取 CC1125的寄存器

Guru**** 2381060 points
Other Parts Discussed in Thread: CC1125
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1397814/cc1125-unable-to-read-registers-of-cc1125

器件型号:CC1125

工具与软件:

我目前从事 CC1125的驱动程序开发工作。 我尝试通过 SPI 接口在 PSoC6微控制器和 CC1125之间建立通信。  我已经浏览过 CC1125的数据表和用户指南、从这里我知道了校准序列。 我了解了用于设置 CC1125各种模式(即空闲、睡眠、发送和接收模式)的寄存器、有一些寄存器可以从一种模式切换到另一种模式。 我已经测试了 SPI 代码、它运行良好。  但是、当我尝试通过 SPI 发送0x8F 来获取器件型号时、无法获取 CC1125的器件型号、该值为0x58。 我将发送寄存器地址作为指令、它是1个字节。 在访问和读回寄存器时是否还需要注意其他事项? 请指派您团队中能够支持我的任何人来启动 CC1125、谢谢。 请考虑我的担忧。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Arathi:

    器件型号寄存器位于扩展寄存器空间中。 您是否首先发送设置了 R 位的0x2F、然后是器件型号地址(0x8F)?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的答复。 我需要获得器件型号、因此我将设置 R 位。 我将发送两个字节的数据、其中第一个字节是0x2F 且设置了 R 位、即0xAF、第二个字节是访问器件型号0x8F 的地址。 我们使用专门针对 PSOC6微控制器的"cyhal_spi_transfer"函数、同时发送这两个字节。 但是、我们无法获得准确的器件型号值。 我特此附上调试结果和测试设置的快照  。 此外、我还要附加 SPI 代码。 请回顾并帮助我解决此问题。

    期待您的答复。

    /*******************************************************************************
     * File Name:   main.c
     *
     * Description: This example project demonstrates the basic operation of SPI
     * resource as Master using HAL. The SPI master sends command packetsto the SPI
     * slave to control an user LED.
     *
     * Related Document: See README.md
     *
     *
     *******************************************************************************
     * Copyright 2023-2024, Cypress Semiconductor Corporation (an Infineon company) or
     * an affiliate of Cypress Semiconductor Corporation.  All rights reserved.
     *
     * This software, including source code, documentation and related
     * materials ("Software") is owned by Cypress Semiconductor Corporation
     * or one of its affiliates ("Cypress") and is protected by and subject to
     * worldwide patent protection (United States and foreign),
     * United States copyright laws and international treaty provisions.
     * Therefore, you may use this Software only as provided in the license
     * agreement accompanying the software package from which you
     * obtained this Software ("EULA").
     * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
     * non-transferable license to copy, modify, and compile the Software
     * source code solely for use in connection with Cypress's
     * integrated circuit products.  Any reproduction, modification, translation,
     * compilation, or representation of this Software except as specified
     * above is prohibited without the express written permission of Cypress.
     *
     * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
     * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
     * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
     * reserves the right to make changes to the Software without notice. Cypress
     * does not assume any liability arising out of the application or use of the
     * Software or any product or circuit described in the Software. Cypress does
     * not authorize its products for use in any products where a malfunction or
     * failure of the Cypress product may reasonably be expected to result in
     * significant property damage, injury or death ("High Risk Product"). By
     * including Cypress's product in a High Risk Product, the manufacturer
     * of such system or application assumes all risk of such use and in doing
     * so agrees to indemnify Cypress against all liability.
     *******************************************************************************/
    
    /*******************************************************************************
     * Header Files
     *******************************************************************************/
    #include "cyhal.h"
    #include "cybsp.h"
    //#include "cy_retarget_io.h"
    
    
    /******************************************************************************
     * Macros
     *******************************************************************************/
    /* SPI baud rate in Hz */
    #define SPI_FREQ_HZ                (1000000UL)
    /* Delay of 1000ms between commands */
    #define CMD_TO_CMD_DELAY           (1000UL)
    /* SPI transfer bits per frame */
    #define BITS_PER_FRAME             (8)
    
    
    /* Assign pins for SPI on SCB1: P10[0], P10[1], P10[2] and P10[3] */
    #define SPI_PORT        P10_0_PORT
    #define SPI_MISO_NUM    P9_1//P10_0_NUM
    #define SPI_MOSI_NUM    P9_0//P10_1_NUM
    #define SPI_SCLK_NUM    P9_2//P10_2_NUM
    #define SPI_SS_NUM      P9_3//P10_3_NUM
    
    #define BUFFER_SIZE 4
    #define DELAY_MS  100
    
    #define PROD_ID1  (0xAF)
    #define PROD_ID2  (0x8F)
    
    
    /*******************************************************************************
     * Global Variables
     *******************************************************************************/
    
    
    /*******************************************************************************
     * Function Prototypes
     *******************************************************************************/
    
    
    /*******************************************************************************
     * Function Definitions
     *******************************************************************************/
    
    /*******************************************************************************
     * Function Name: handle_error
     ********************************************************************************
     * Summary:
     * User defined error handling function
     *
     * Parameters:
     *  uint32_t status - status indicates success or failure
     *
     * Return:
     *  void
     *
     *******************************************************************************/
    //void handle_error(uint32_t status)
    //{
    //	if (status != CY_RSLT_SUCCESS)
    //	{
    //		CY_ASSERT(0);
    //	}
    //}
    
    /*******************************************************************************
     * Function Name: main
     ********************************************************************************
     * Summary:
     * The main function.
     *   1. Initializes the board, retarget-io and led
     *   2. Configures the SPI Master to send command packet to the slave
     *
     * Parameters:
     *  void
     *
     * Return:
     *  int
     *
     *******************************************************************************/
    int main(void)
    {
    	cy_rslt_t   result;
    	cyhal_spi_t mSPI;
    	//cyhal_spi_t sSPI;
    	uint32_t    spi_master_frequency = 1000000;
    	uint8_t    transmit_ID[2];
    
    
    	uint8_t rx_buffer[BUFFER_SIZE] = {0};
    
    #if (USE_SPI_SLAVE)
    	/* Configure SCB1 pins for SPI Slave operation */
    	Cy_GPIO_SetDrivemode(SPI_PORT, SPI_MISO_NUM, CY_GPIO_DM_STRONG_IN_OFF);
    	Cy_GPIO_SetDrivemode(SPI_PORT, SPI_MOSI_NUM, CY_GPIO_DM_HIGHZ);
    	Cy_GPIO_SetDrivemode(SPI_PORT, SPI_SCLK_NUM, CY_GPIO_DM_HIGHZ);
    	Cy_GPIO_SetDrivemode(SPI_PORT, SPI_SS_NUM,   CY_GPIO_DM_HIGHZ);
    #endif
    
    	/* Initialize the device and board peripherals */
    	result = cybsp_init();
    
    	/* Init SPI master */
    	result = cyhal_spi_init(&mSPI, SPI_MOSI_NUM, SPI_MISO_NUM, SPI_SCLK_NUM, SPI_SS_NUM, NULL,
    			8, CYHAL_SPI_MODE_00_MSB, false);
    
    	cyhal_gpio_init(SPI_SS_NUM, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, true); // true sets the CS pin high
    
    	/* Set the SPI baud rate */
    	result = cyhal_spi_set_frequency(&mSPI, spi_master_frequency);
    
    	/* Enable interrupts */
    	__enable_irq();
    
    	for (;;)
    	{
    		cyhal_system_delay_ms(DELAY_MS);
    		// Pull CS low to select the slave
    		cyhal_gpio_write(SPI_SS_NUM, false);
    
    		transmit_ID[0] = PROD_ID1;
    		transmit_ID[1] = PROD_ID2;
    
    		cyhal_spi_transfer(&mSPI, transmit_ID[0], 1, NULL, 0, 0x00);
    
    		cyhal_spi_transfer(&mSPI, NULL, 0, rx_buffer, 1, 0x00);
    		//cyhal_system_delay_ms(DELAY_MS);
    
    		cyhal_gpio_write(SPI_SS_NUM, true);
    		cyhal_system_delay_ms(DELAY_MS);
    
    	}
    
    }
    
    /* [] END OF FILE */
    

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您是否有逻辑分析仪或示波器中显示 SPI 通信的图?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    有。 我已经在示波器上检查了 CC1125的芯片选择、SI、SO 和 CLK 引脚。 我能够传输16位地址以正确获取产品 ID。 但是、我仍然无法收到产品 ID。 我还检查了16个时钟。 我将得到产品 ID 为0x60。 是这样吗?  谨随函附上这些图。