CYBT-343026-EVAL PUART Rx to SPP BT Tx transmission question

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

cross mob
sylvain_77176
Level 2
Level 2
First solution authored 5 replies posted 25 sign-ins

Hello,

 

I just start using CYBT-343026-EVAL on IDE modusToolbox V2.2.0 and based on examples "HAL_PUART" and "RFCOMM_Serial_Port" I made a software to get PUART Rx data and send it  to a PC  hyperterminal interface (data are send over SPP). This simple test software is working correctly when there is no real time constraint. 

I Find cypress solution really interesting  but now I  needed your help :-D. My final application  must transmit around 300 octets every 4ms. When I try to reach this "transmission rate" the module stop transmission and I have to restart it. Please find below an extract of the software PUART Rx to SPP TX function :

#define WICED_EIR_BUF_MAX_SIZE 264

uint8_t puart_rx_buffer[WICED_EIR_BUF_MAX_SIZE];

/**
Function Name:
puart_rx_interrupt_callback

Function Description:
@brief Interrupt routine called when PUART has data to be read

@param unused Not used

@return void
*/
void puart_rx_interrupt_callback(void* unused)
{
/* There can be at most 16 bytes in the HW FIFO.*/
uint8_t readbyte = 0;
uint16_t rx_byte_cnt = 0;

/* read Rx data and save data in buffer loop */
while(wiced_hal_puart_read(&readbyte) &&
rx_byte_cnt < WICED_EIR_BUF_MAX_SIZE)
{
puart_rx_buffer[rx_byte_cnt] = readbyte;
rx_byte_cnt++;
}

/* If data read */
if (rx_byte_cnt != 0)
{
/* If SPP session */
if(spp_handle != 0)
{
/* If buffer not full */
if(wiced_bt_spp_can_send_more_data (spp_handle))
{
/* Send bluetooth data */
wiced_bt_spp_send_session_data(spp_handle,puart_rx_buffer, rx_byte_cnt);
}
}
}
else
{
/* No data to transmit */
}

/* If EIR buffer completely fill don't clear interrupt */
if (rx_byte_cnt < WICED_EIR_BUF_MAX_SIZE)
{
/* Clear puart interrupt*/
wiced_hal_puart_reset_puart_interrupt();
}
else
{
/* Do nothing buffer will be fill on next handler call */
}
}

I made another  test where "wiced_bt_spp_send_session_data()" is call every 4ms the result is the same.

My question Are :

- Are there some rules concerning the SPP transmission ? Is it possible that "puart_rx_interrupt_callback()" interrupt create disfonctionment ?

- is there a solution to be informed about the end of SPP bluetooth transmission ? what is the purpose of callback "wiced_transport_tx_complete_t()" ?

Thank in advance for your help

Best regards 

Sylvain

 

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

I am not sure, how you are ensuring the condition "300 bytes every 4ms" in your application.  

Anyway, Could you please try the attached source. I have initialized a timer and called the wiced_hal_puart_reset_puart_interrupt() in it's timer callback function, since our software team has found a minor issue when calling the reset interrupt inside the puart rx callback. 

Please let me know if you have any doubt or concerns.

Thanks,

-Dheeraj

View solution in original post

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

Hi,

In my opinion, the data rate which you have mentioned is achievable. We need to check whether the PUART is creating any problem or not. Did you try SPP alone to get this data rate?

If possible, please share your project so that I can try reproducing the issue at my side and debug.

 

wiced_transport_tx_complete_t() is tx complete callback used for WICED Transport (when using HCI UART).

Thanks,

-Dheeraj

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,

Yes  I have try to use SPP to send 300 bytes every 4ms and it is transmiting data without interruption.

Please find attached the test software.

Thank you !

Edit on March 5, 2021 :

Issue still open to sum up the problem of the attached project that is receiving data on PUART then transmiting data using SPP  : 

  • When PC TX on PUART 300 bytes every seconds, Data are correctly transmit by CYBT-343026-EVAL,
  • When microcontroler Tx on PUART 300 bytes every 4ms, Data are not correctly transmit by CYBT-343026-EVAL and CYPRESS restart is necessary.
0 Likes
lock attach
Attachments are accessible only for community members.
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

I am not sure, how you are ensuring the condition "300 bytes every 4ms" in your application.  

Anyway, Could you please try the attached source. I have initialized a timer and called the wiced_hal_puart_reset_puart_interrupt() in it's timer callback function, since our software team has found a minor issue when calling the reset interrupt inside the puart rx callback. 

Please let me know if you have any doubt or concerns.

Thanks,

-Dheeraj

0 Likes

Hello, 

Thank you very much for your answer I have test your modification and the behaviour is the same. I am currently using HCI and sending data thank to this interface and I am having better result that is why I think I will continious my development with this interface.

 

Best regards and thank you very much for your support !

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

hi,

 

Sure. HCI UART has bigger buffers, so that will be useful if you want to transmit at high data rate.

If possible, could you please share how did you test the PUART code?

When I did testing with the modification as I mentioned in my previous post, I could transmit 1MB data both sides without any interruption. And the time interval is provided using a wiced_timer. I am little curious why the workaround again causing trouble to your setup.

 

Thanks,

-Dheeraj

0 Likes