This is the inquiry response:

Shimmer2RClient::readByte 2 PacketType
Shimmer2RClient::readByte 250 Sampling Rate
Shimmer2RClient::readByte 0 Sensitivity
Shimmer2RClient::readByte 0 Conf
Shimmer2RClient::readByte 4 NumChans
Shimmer2RClient::readByte 1 BufSize
Shimmer2RClient::readByte 0 Chan1
Shimmer2RClient::readByte 1 Chan2
Shimmer2RClient::readByte 2 Chan3
Shimmer2RClient::readByte 13 Chan4

Doing the inquiry response helped me fix the problem. I was trying to
calculate the number of channels manually but using the NumChans from the
inqury response fixed it.

Thanks for the help,

Nick

On Wed, May 16, 2012 at 11:36 AM, Nicholas Hosein <[email protected]>wrote:

> I have mostly implemented it but am not sure how large the packet is for
> the inquiry response. The docs say
>
> Packet Type | ADC Sampling rate | Accel Sensitivity | Config Byte 0 |Num
> Chans | Buf size | Chan1 | Chan2 | ... | ChanX
>
> Does this mean that the packet size is not constant and I have to read in
> NumChans before i know the packet size?
>
>
>
>
> On Wed, May 16, 2012 at 12:29 AM, Jong Chern Lim <
> [email protected]> wrote:
>
>>  Hi Nick,****
>>
>> ** **
>>
>> The code seems logical and fine. Can you use the inquiry command to check
>> what the channel contents are for the data packet being sent by the Shimmer
>> unit, it might give a clue as to what might be going on. ****
>>
>> ** **
>>
>> JC  ****
>>
>> ** **
>>  ------------------------------
>>
>> *From:* [email protected] [mailto:[email protected]] *On
>> Behalf Of *Nicholas Hosein
>> *Sent:* 15 May 2012 21:25
>> *To:* Jong Chern Lim
>> *Cc:* [email protected]
>>
>> *Subject:* Re: [Shimmer-users] EMG Packet Question
>> ****
>>
>>  ** **
>>
>> *And by correctly i mean it sends 6 bytes of emg data which seems wrong
>> since it should be 2 bytes.****
>>
>> ** **
>>
>> -Nick****
>>
>> On Tue, May 15, 2012 at 1:21 PM, Nicholas Hosein <[email protected]>
>> wrote:****
>>
>> Hi Jong,****
>>
>> ** **
>>
>> This is the C++ code that ive been using. It works for acc/gyr/mag. Now i
>> am testing it on emg:****
>>
>> ** **
>>
>>     char arg0 = SET_SENSORS_COMMAND;****
>>
>>     char arg1 = (acc << 7)+(gyr << 6)+(mag << 5)****
>>
>> +(ecg << 4)+(emg << 3)+(gsr << 2)****
>>
>> +(ex7 << 1)+(ex0 << 0);****
>>
>>     char arg2 = 0;****
>>
>> ** **
>>
>>     socket->write(&arg0,1);****
>>
>>     socket->write(&arg1,1);****
>>
>>     socket->write(&arg2,1);****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>>  ** **
>>
>> For the EMG Shimmer Mote when i have all sensors off except the emg (acc
>> disabled) I get the situation in my previous email with a packet size of 9
>> bytes including header and timestamp.****
>>
>> ** **
>>
>> I do receive an ack from the shimmer mote after sending the command. When
>> i request to start the collection of data the data comes correctly at the
>> frequency i specify.****
>>
>> ** **
>>
>> Much Thanks,****
>>
>> ** **
>>
>> Nick****
>>
>> ** **
>>
>> On Tue, May 15, 2012 at 12:22 AM, Jong Chern Lim <
>> [email protected]> wrote:****
>>
>> Hi Nicholas,****
>>
>>  ****
>>
>> Could you explain a little more about what you mean by ‘sent the signal
>> to enable the acc’? As an example using java (assuming you are using the
>> standard serial protocol), the transmitted packet should look something
>> like ****
>>
>>  ****
>>
>> write(new byte[]{0x08, 0x08, 0x00}); ****
>>
>>  ****
>>
>> If you refer to
>> http://tinyos.cvs.sourceforge.net/viewvc/tinyos/tinyos-2.x-contrib/shimmer/apps/BoilerPlate/Shimmer.h?content-type=text%2Fplain,
>>  you will see that the first 0x08 is the packet type: Set_Sensors_Command
>> and the second 0x08 is SENSOR_EMG. ****
>>
>>  ****
>>
>> Were you able to receive an Ack packet after sending the set sensor
>> command packet?****
>>
>>  ****
>>
>> Regards,****
>>
>> JC****
>>  ------------------------------
>>
>> *From:* [email protected] [mailto:
>> [email protected]] *On Behalf Of *Nicholas Hosein
>> *Sent:* 14 May 2012 23:16
>> *To:* [email protected]
>> *Subject:* Re: [Shimmer-users] EMG Packet Question****
>>
>>  ****
>>
>> In addition the data doesnt seem to change with stimulus from the muscle.
>> ****
>>
>> On Thu, May 10, 2012 at 2:09 PM, Nicholas Hosein <[email protected]>
>> wrote:****
>>
>> So i currently have acc/gyr/mag working and was adding emg support to my
>> C++ program. I sent the signal to enable the acc/emg (bit3 = 1 ). I then
>> receive 9 bytes from the shimmer = 1 header, 2 timestamp, 6 data.****
>>
>>  ****
>>
>> My question is why does the emg have 6 bytes of data? The accelerometer
>> has x,y,z so 6 bytes makes sense but the emg is just one signal?****
>>
>>  ****
>>
>> Thanks,****
>>
>>  ****
>>
>> Nick****
>>
>>  ****
>>
>> ** **
>>
>> ** **
>>
>
>
_______________________________________________
Shimmer-users mailing list
[email protected]
https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users

Reply via email to