CYBT-413055-02 timer and interrupt conflict.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
TDC
Level 1
Level 1
First solution authored 10 sign-ins 5 replies posted

Hello @Owen_Zhang123 ,  @DheerajK_81 ,  @AnjanaM_61 , @MotooTanaka 

 
I am using the CYBT-413055-02 module using a custom pcb, the ide is Eclipse IDE for MODUS TOOLBOX 2.4.
1. I want to read external IC data using spi, which is working perfectly. I have a 2 ms timer, 1 second timer, and one hardware external interrupt. My external IC is set as 500 samples/sec.
The external IC indicates that the data is ready to read by making a pin low, which is read by the hardware external interrupt. So I get an interrupt every 2 ms. The problem i am facing is when my communication starts with the external ic and the interrupt starts my all timers stops. Even after stopping the communication with external ic. my timer interrupts stop. Below shown are my code configurations.
 
 
#define DRDY_INT_PIN_CONFIGURE          wiced_hal_gpio_configure_pin(DRDY,GPIO_INPUT_ENABLE|GPIO_PULL_UP|GPIO_EN_INT_FALLING_EDGE,GPIO_PIN_OUTPUT_HIGH);
#define ENABLE_DRDY_Int                 wiced_hal_gpio_register_pin_for_interrupt( DRDY, DRDY_interrupt_handler, NULL );                   // Enable Interrupt on P1.0...button detect
#define DISABLE_DRDY_Int                wiced_hal_gpio_configure_pin(DRDY,GPIO_INTERRUPT_DISABLE,GPIO_PIN_OUTPUT_HIGH);
 
2. The module enters into sniff mode after 15 sec of communication with external IC. Below is the debug trace data. see these line Power mgmt status event: bd (00 1a 7d da 71 10 ) status:2 hci_status:0
 
09:59:20.956 -> app_management_callback 9
09:59:20.956 -> app_management_callback 8
09:59:20.956 -> BTM_PAIRING_IO_CAPABILITIES_REQUEST_EVT bda 00 1a 7d da 71 10 \rnapp_management_callback 19
09:59:21.941 -> NVRAM ID:512 read out of 136 bytes:0 result:40
09:59:21.941 -> Key retrieval failure
09:59:21.941 -> app_management_callback 4
09:59:21.988 -> Pairing with: BdAddr:00 1a 7d da 71 10  Status:0 Len:248 Name:DESKTOP-JI0BCIB
09:59:22.034 -> app_management_callback 11
09:59:22.034 -> Pairing Complete: 0
09:59:22.034 -> app_management_callback 18
09:59:22.034 -> NVRAM ID:512 written :136 bytes result:0
09:59:22.269 -> app_management_callback 12
09:59:22.269 -> Encryption Status Event: bd (00 1a 7d da 71 10 ) res 0
09:59:47.737 -> app_management_callback 19
09:59:47.737 -> NVRAM ID:512 read out of 136 bytes:136 result:0
09:59:47.971 -> app_management_callback 12
09:59:47.971 -> Encryption Status Event: bd (00 1a 7d da 71 10 ) res 0
09:59:47.971 -> spp_connection_up_callback handle:2 address:00 1a 7d da 71 10
09:59:48.534 -> data : S
09:59:49.002 -> data : R
10:00:05.361 -> data : F
10:00:05.408 -> data : T
10:00:18.111 -> app_management_callback 2
10:00:18.158 -> Power mgmt status event: bd (00 1a 7d da 71 10 ) status:2 hci_status:0
10:00:23.595 -> data : S
10:00:43.893 -> spp_connection_down_callback handle:2 rx_bytes:0
 
Thank You.
0 Likes
3 Replies
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

I have some questions for you. 

First could you please share us the BTSPY logs? 

Are you using any other sleep modes such as SDS, PDS, etc.?  Are you able to observe it only with the custom PCB?

 

You can also try to cancel the sniff mode using wiced_bt_dev_cancel_sniff_mode(). if you doubt on sniff mode. 

Thanks,

-Dheeraj.P.K

 

0 Likes
Respected Sir,
 
First could you please share us the BTSPY logs? 
this log is record using Puart using serial terminal
 
12:42:29.182 -> hci_control_write_eir 269c8c
12:42:29.182 -> EIR :10 09 54 65 6c 65 45 43 47 2d 54 52 49 55 4d 50
12:42:29.182 -> 48 03 03 01 11 00
12:42:54.101 -> app_management_callback 9
12:42:54.101 -> app_management_callback 8
12:42:54.101 -> BTM_PAIRING_IO_CAPABILITIES_REQUEST_EVT bda 00 1a 7d da 71 10
12:42:55.132 -> app_management_callback 19
12:42:55.132 -> NVRAM ID:512 read out of 136 bytes:136 result:0
12:42:55.132 -> app_management_callback 4
12:42:55.132 -> Pairing with: BdAddr:00 1a 7d da 71 10  Status:0 Len:248 Name:DESKTOP-JI0BCIB
12:42:55.229 -> app_management_callback 11
12:42:55.229 -> Pairing Complete: 0
12:42:55.229 -> app_management_callback 18
12:42:55.229 -> NVRAM ID:512 written :136 bytes result:0
12:42:55.418 -> app_management_callback 12
12:42:55.418 -> Encryption Status Event: bd (00 1a 7d da 71 10 ) res 0
12:43:29.445 -> app_management_callback 19
12:43:29.445 -> NVRAM ID:512 read out of 136 bytes:136 result:0
12:43:29.680 -> app_management_callback 12
12:43:29.680 -> Encryption Status Event: bd (00 1a 7d da 71 10 ) res 0
12:43:29.727 -> spp_connection_up_callback handle:2 address:00 1a 7d da 71 10
12:43:30.244 -> data : S
12:43:30.757 -> data : R
12:43:34.372 -> data : F
12:43:34.372 -> data : T
12:43:49.519 -> app_management_callback 2
12:43:49.519 -> Power mgmt status event: bd (00 1a 7d da 71 10 ) status:2 hci_status:0
12:43:55.839 -> data : S
12:43:55.839 -> app_management_callback 2
12:43:55.839 -> Power mgmt status event: bd (00 1a 7d da 71 10 ) status:0 hci_status:0
12:43:56.822 -> spp_connection_down_callback handle:2 rx_bytes:0
 
Are you using any other sleep modes such as SDS, PDS, etc.? 
->No i am not using any sleep mode for now.
 
 Are you able to observe it only with the custom PCB?
-> i don't have any development board. Testing is done on custom PCB only.
 
You can also try to cancel the sniff mode using wiced_bt_dev_cancel_sniff_mode(). if you doubt on sniff mode. 
-> i did this, but i am getting same issue.
result = wiced_bt_dev_cancel_sniff_mode( p_power_mgmt_notification->bd_addr );
WICED_BT_TRACE("sniff mode cancel = %d", result);
 
14:55:49.221 -> app_management_callback 21
14:55:49.221 -> app_management_callback 20
14:55:49.221 -> app_management_callback 20
14:55:49.221 -> app_management_callback 0
14:55:50.248 -> hci_control_write_eir 269c8c
14:55:50.248 -> EIR :10 09 54 65 6c 65 45 43 47 2d 54 52 49 55 4d 50
14:55:50.248 -> 48 03 03 01 11 00
14:56:02.367 -> app_management_callback 19
14:56:02.367 -> NVRAM ID:512 read out of 136 bytes:136 result:0
14:56:02.601 -> app_management_callback 12
14:56:02.601 -> Encryption Status Event: bd (00 1a 7d da 71 10 ) res 0
14:56:02.695 -> spp_connection_up_callback handle:2 address:00 1a 7d da 71 10
14:56:03.224 -> data : S
14:56:03.692 -> data : R
14:56:08.423 -> data : F
14:56:08.423 -> data : A
14:56:11.048 -> data : S
14:56:12.826 -> spp_connection_down_callback handle:2 rx_bytes:0
14:56:22.880 -> app_management_callback 19
14:56:22.880 -> NVRAM ID:512 read out of 136 bytes:136 result:0
14:56:23.115 -> app_management_callback 12
14:56:23.115 -> Encryption Status Event: bd (00 1a 7d da 71 10 ) res 0
14:56:23.162 -> spp_connection_up_callback handle:2 address:00 1a 7d da 71 10
14:56:23.677 -> data : S
14:56:24.191 -> data : R
14:56:25.550 -> data : F
14:56:25.598 -> data : A
14:56:42.903 -> app_management_callback 2
14:56:42.903 -> sniff mode cancel = 8106Power mgmt status event: bd (00 1a 7d da 71 10 ) status:2 hci_status:0
 
 
using BTSPY, i am using PUART for trace, below are my configurations
const wiced_transport_cfg_t transport_cfg =
{
    .type = WICED_TRANSPORT_UART,
    .cfg =
    {
        .uart_cfg =
        {
            .mode = WICED_TRANSPORT_UART_RAW_MODE,
            .baud_rate =  HCI_UART_DEFAULT_BAUD
        },
    },
#if BTSTACK_VER >= 0x03000001
        .heap_config =
        {
            .data_heap_size = 1024 * 4 + 1500 * 2,
            .hci_trace_heap_size = 1024 * 2,
            .debug_trace_heap_size = 1024,
        },
#else
    .rx_buff_pool_cfg =
    {
        .buffer_size  = TRANS_UART_BUFFER_SIZE,
        .buffer_count = 1
    },
#endif
    .p_status_handler    = NULL,
    .p_data_handler      = NULL,
    .p_tx_complete_cback = NULL
};
 
 // Set to PUART to see traces on peripheral uart(puart) if platform has PUART
     wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

     wiced_hal_puart_select_uart_pads( WICED_P10, WICED_P06, 0, 0);
 
void app_trace_callback( wiced_bt_hci_trace_type_t type, uint16_t length, uint8_t* p_data )
{
    wiced_transport_send_hci_trace( host_trans_pool, type, length, p_data);
}
 
i am only getting this on BTSPY
 
7   14:21:15.828    -   8   14:21:17.828    -   9   14:21:17.828    -   10   14:21:17.828    -   Opened \\.\COM13 at speed: 115200 flow on
Startup
Set discoverable:1, connectable:1
Set Pairable:1
 
My timers are not resolved, i have multiple c files do i need to add something in makefile ?
Thank you

 

0 Likes
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

We will discuss it in the SFDC case.

0 Likes