nigelrogasch / MAGIC

Magnetic stimulator interface controller toolbox
23 stars 9 forks source link

Any Suggestion on sending Rapid2 unlock code to the stimulator? #11

Closed SallyWang9898 closed 3 years ago

SallyWang9898 commented 3 years ago

Hi. I'm using a rapid2 stimulator with software Version 11.0, and managed to obtain the unlock code from the manufacturer. However, I had some trouble regarding sending it to the stimulator. Specifically, I’m confused with the CRC at the end of the unlock code. The code specific for our stimulator is ‘5f30-da26cd33-4d’, by adding the ‘Command’ it becomes ‘Q5f30-da26cd33-4d’. If I calculate one’s compliment CRC using all 17 bytes, it would be ‘01100110010’ in binary or 818 in decimal, too large to be sent in one byte. I noticed the last two bytes are indicated as MSB and LSB of unlock code CRC, respectively, but I didn’t quite understand it. Any instructions would be extremely appreciated. Also, it would be even better if you add a function of sending the unlock code to the stimulator into your toolbox.

my matlab code is:

serialPortObj = serial('COM1', 'BaudRate', 9600, 'DataBits', 8, 'StopBits', 1, 'Parity', 'none', 'FlowControl', 'none', 'Terminator', '?');
fopen(serialPortObj);
fprintf(serialPortObj, 'Q5f30-da26cd33-4d');

Thank you so much for reading this.

Sally Wang

gl-magstim commented 3 years ago

Hi Sally,

the bytes '4' (0x34) and 'd' (0x64) are the MSB and LSB of the unlock code itself, you don't need to worry about this really as it won't change from '4d'.

The checksum for the whole command is the lower 8 bits of the one's compliment, in the case of decimal 818 (0x0332) this would be 0x32 or '2' in ascii.

giving a final command string of ‘Q5f30-da26cd33-4d2’

Hope this helps.

gl-magstim commented 3 years ago

Hi Sally,

I am sorry I do not know this toolbox specifically, I just know the Magstim products, maybe someone else can help with this.

SallyWang9898 commented 3 years ago

Thank you for your quick reply!! I fixed this now! Also I realised by now that unlock code can serve as a varargin, and the toolbox automatically send it to the stimulator. For anyone with the same question, try: magstimObj=rapid('COM1','rapid',unlockCode) Thanks again.

Lena-Marreel commented 1 year ago

Hi Sally,

We are currently struggling with a similar issue. However while magstimObj=rapid('COM1','rapid',unlockCode) runs fine for us, we get errors when trying to connect with magstimObj.connect

did you submit the unlockCode as unlockCode = '5f30-da26cd33-4d'; ?

Many thanks for any advice. Best Lena

SallyWang9898 commented 1 year ago

Hi Lena, Sorry for this late reply. The unlock code is unique for each device. You have to ask the Magstim company to get it. I submit the code as you posted.

Hi Sally,

We are currently struggling with a similar issue. However while magstimObj=rapid('COM1','rapid',unlockCode) runs fine for us, we get errors when trying to connect with magstimObj.connect

did you submit the unlockCode as unlockCode = '5f30-da26cd33-4d'; ?

Many thanks for any advice. Best Lena

Lena-Marreel commented 1 year ago

Hi Lena, Sorry for this late reply. The unlock code is unique for each device. You have to ask the Magstim company to get it. I submit the code as you posted.

Hi Sally, We are currently struggling with a similar issue. However while magstimObj=rapid('COM1','rapid',unlockCode) runs fine for us, we get errors when trying to connect with magstimObj.connect did you submit the unlockCode as unlockCode = '5f30-da26cd33-4d'; ? Many thanks for any advice. Best Lena

Hi Sally, no worries. We have our unique code but was unsure whether I did it right. We got it to work now, thankyou!