我们在测试HCI UART和SPI 同时通信时,出现的问题如下:
- 当设备不初始化 SPI 时,设备可以正常输出LOG,附件中的示例程序 每秒会输出“1”是正常的
示波器抓取的 TX波形如下: - 当设备初始化 SPI时和HCI UART 输出的值一直是 6C(十六进制)
示波器抓取TX的波形如下:
SPI 的 初始化代码如下:
void spi_master_init( void )
{
WICED_BT_TRACE("spi_master_init\r\n");
wiced_hal_pspi_init( MASTER1_CONFIG,
INPUT_PIN_FLOATING,
MASTER1_P24_CLK_P27_MOSI_P25_MISO,
SPI_CLOCK_SPEED,
SPI_LSB_FIRST,
SPI_SS_ACTIVE_LOW,
SPI_MODE_0,
SPI_CS);
/*SPI CS init */
wiced_hal_gpio_configure_pin(SPI_CS, GPIO_OUTPUT_ENABLE, GPIO_PIN_OUTPUT_HIGH );//chip select
//spi_master_configure_gpio();
}
HCI UART 和 SPI 的共有一个buffer?
HCI UART和SPI不是共用buffer。你的应用中是通过HCI UART输出log吗?
请参考demo/hci_uart_spi_bridge工程中SPI相关的代码。如果还是有问题,请上传一个可以复现问题的程序,我这边debug一下。
Hi,
我的应用程序是通过HCI UART 进行输出LOG的。
在demo/hci_uart_spi_bridge工程中添加了如下代码:
wiced_transport_cfg_t transport_cfg =
{
.type = WICED_TRANSPORT_UART, /**< Wiced transport type. */
/* Transport Interface Configuration */
.cfg = {
/* UART Transport Configuration */
.uart_cfg = {
.mode = WICED_TRANSPORT_UART_HCI_MODE, /**< UART mode, HCI or Raw */
.baud_rate = HCI_UART_DEFAULT_BAUD /**< UART baud rate */
}
},
/* Rx Buffer Pool Configuration */
.rx_buff_pool_cfg = {
.buffer_size = 1024, /**< Rx Buffer Size */
.buffer_count = 2 /**< Rx Buffer Count */
},
.p_status_handler = NULL, /**< Wiced transport status handler.*/
.p_data_handler = NULL, /**< Wiced transport receive data handler. */
.p_tx_complete_cback = NULL /**< Wiced transport tx complete callback. */
};
/*
* Application Start, ie, entry point to the application.
*/
APPLICATION_START( )
{
/* Initialize the transport configuration */
wiced_transport_init( &transport_cfg );
wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_HCI_UART );
wiced_bt_stack_init( hci_bridge_management_callback , &hci_bridge_cfg_settings, hci_bridge_cfg_buf_pools);
}
wiced_result_t hci_bridge_management_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data )
{
wiced_result_t result = WICED_BT_SUCCESS;
switch( event )
{
/* Bluetooth stack enabled */
case BTM_ENABLED_EVT:
gpio_initialized = TRUE;
SPI_CLOCK_SPEED = 8000000;
spi_master_init();
// spi_register_tx_rx_handler(spi_master_handle_tx_and_rx);
spi_master_register_data_received_cb(hci_bridge_spi_master_data_received);
hci_puart_init();
//hci_bridge_send_device_started_evt();
/* Starting the app timers , seconds timer and the ms timer */
wiced_bt_app_start_timer( 1, 0, hello_sensor_timeout, NULL );
break;
case BTM_DISABLED_EVT:
break;
default:
break;
}
return result;
}
void hello_sensor_timeout( uint32_t count )
{
static uint32_t v_timercount;
v_timercount++;
WICED_BT_TRACE("hello_sensor_timeout:%d\n",v_timercount);
}
另外makefile 中:添加了如下代码
APP_PATCHES_AND_LIBS += rtc_lib.a
APP_PATCHES_AND_LIBS += FM25Q04_sflash.a
C_FLAGS += -DWICED_BT_TRACE_ENABLE
# If defined, HCI traces are sent over transport/WICED HCI interface
#C_FLAGS += -DHCI_TRACE_OVER_TRANSPORT
C_FLAGS += -DWICED_HCI_TRANSPORT_UART=1
#C_FLAGS += -DWICED_HCI_TRANSPORT_SPI=2
ifneq (,$(findstring SPI,$(TRANSPORT)))
$(info Transport=SPI)
C_FLAGS += -DWICED_HCI_TRANSPORT=WICED_HCI_TRANSPORT_SPI
else
$(info Transport=UART)
C_FLAGS += -DWICED_HCI_TRANSPORT=WICED_HCI_TRANSPORT_UART
endif
再hello_sensor_timeout 回调函数中做了打印,打印结果应该是WICED_BT_TRACE("hello_sensor_timeout:%d\n",v_timercount);
但是实际打印出来的效果是一直是 十六进制的“41”,请帮忙查看原因,问题比较紧急!XinghaoZ_26AnjanaM_61
我这边也可以复现你的问题,可能是两个驱动的底层冲突了,需要进一步的debug。
好的,我们现在的产品需要 同时使用到 HCI UART 和SPI,这个问题大概什么时候能解决?
The problem has escalated to case system. Let's discuss it there.
我怎么查找我的 问题处理进度?在哪个table 下查?