Subject:
|
Re: Difficulty with WRITE COMMAND over BT
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Fri, 27 Apr 2007 12:50:55 GMT
|
Viewed:
|
18862 times
|
| |
| |
In lugnet.robotics.nxt, Pavel Petrovic wrote:
> - however, if I try to download a real .rxe file that was produced using NBC
> compiler (and this .rxe file can be downloaded normally using NBC utility and
> runs on NXT correctly otherwise), then writing to file works until the last 72
> or so characters are to be downloaded. At that time, the WRITE COMMAND simply
> does not respond with a reply packet as it should. It happens no matter how
> big/small chunks I use to send the data to NXT over bloodytooth (and they are
> always less then 64 bytes - the packet limit size).
It's hard to say what exactly might be going wrong. Here's how I write a file
to the NXT:
// write in < 64 byte chunks
xferred := 0;
aStream.Position := 0; // start at the beginning
while xferred < size do
begin
cnt := Min(size - xferred, kNXT_MaxBytes-3);
// fill our buffer with the right number of bytes
for i := 0 to cnt - 1 do
aStream.Read(buf.Data[i], 1);
// write these bytes to the NXT
Result := NXTWrite(handle, buf, cnt, cnt = (size - xferred));
if not Result then Break;
inc(xferred, cnt);
end;
The maximum number of bytes per write is 61 (64-3). Each command is sent with
the no response flag set (0x81 rather than 0x81) except for the very last
command (when cnt = (size - xferred)).
John Hansen
|
|
Message has 1 Reply: | | Re: Difficulty with WRITE COMMAND over BT
|
| (...) Thank you very much for the reply. It is still consistently puzzling. If I write some other file - for example a text file named file.txt, I can write and close, and see it in the list (through findfirst/findnext) successfully. This works both (...) (18 years ago, 28-Apr-07, to lugnet.robotics.nxt)
|
Message is in Reply To:
| | Difficulty with WRITE COMMAND over BT
|
| Hi, I am attempting to download a .rxe program file to NXT from some programming environment that allows communicating over serial port. So I connect to NXT (with 1.04 firmware) from the WinXPSP2 box with BT USB dongle, and use the commands (...) (18 years ago, 26-Apr-07, to lugnet.robotics.nxt)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|