begin a stream transfer synchronously?

Discussions related to embedded firmware, driver, and user mode application software development
Post Reply
reesebo
Posts: 11
Joined: Tue Jun 23, 2015 2:40 pm

begin a stream transfer synchronously?

Post by reesebo »

Hello,

I would like to use the stream interface, but would like to start the stream based on a timestamp. Is there a way to do this? I can't use the synchronous interface since it blocks; I need to be able to interrupt a transfer and my file size is large.

Thanks,

Reese
jump
Posts: 58
Joined: Mon Mar 03, 2014 5:31 pm
Contact:

Re: begin a stream transfer synchronously?

Post by jump »

Why don't you start the synchronous transfer in a dedicated thread so that it doesn't block your program? Then based on the timestamp, you can choose to discard the samples if you don't need them or write them to a file or to whatever destination you need :)
reesebo
Posts: 11
Joined: Tue Jun 23, 2015 2:40 pm

Re: begin a stream transfer synchronously?

Post by reesebo »

Hi, thanks for the reply. Is it possible to gracefully interrupt a streaming transmit after it starts? I had some difficulty with this, so I went with the manual setup.

Thanks
Reese
jump
Posts: 58
Joined: Mon Mar 03, 2014 5:31 pm
Contact:

Re: begin a stream transfer synchronously?

Post by jump »

Sorry for the late reply.

The trickiest part is when you want to change the sample rate on the fly. You may run into buffer overflow issues.

To stop the streaming, I simply used a boolean value shared between the threads (main thread sets it and the thread responsible of streaming only reads it). In the synchronous loop I check the value of the boolean and stop the streaming. The main thread joins the thread to ensure it exited properly.
I'm pretty sure this should be part of the examples in the github of bladeRF so may find C code to start with.
Post Reply