Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - kb1gtt

Pages: [1] 2 3 ... 5
Is there a way to use return DELAY_SERVING; from fnInsertString? I seem to have that function working from from fhHandleWeb, but it jumps off in the weeds when I run it from fnInsertString. I found this thread which helps me understand this delay web page thing, but I haven't figured out how to use it several times to get each piece of data.

Hmmm, Is fnInsertString a part of this task?


I seem to recall that this code can run from serial coms as well as Ethernet coms. Perhaps it's not stopping because it's not part of that task. I'm having a bit of trouble figuring out the included scope of TASK_ETHERNET.

I'm have good success in creating a web page that allows me to configure embedded parameters via HTTP page. However I'm also trying to get a stream of binary data out of it. Right now myfirsttask runs about every .2 seconds producing new data on each pass. I'm looking to stream this data to a blah.csv file on my PC. In webinterface.c I can access the variables used by myfirsttask, which includes an instantaneous snap shot of the stream data at that point. However that data is only good for that instance. I need webinterface.c to wait until new data is ready, then send the data as its produced.

If the stream data is old and has already been sent, I currently return from webinterface.c with a length of 0. Then on the next pass if new data is available, I send it out via http. This seems to have nearly worked, except I'm wasting CPU cycles by polling with webinterface.c, and after I get two chunks of streamed data, txlength overflows and things go bad.

I've tried setting task E to suspended then in myfirsttask, I set it back to stop. I expected this to prevent the code in webinterface.c from running, however it keeps running. Which didn't work as I expected. So I wonder, am I using this correctly? Is there a way I can pause the http code until a new chunk of data is ready in myfirsttask? Perhaps I should be using passing messages but I couldn't figure out how to pass those from myfristtask to the function in webinterface.c.

I'm at a bit of a loss right now.

It appears I have fixed this. I changed case 'J' like this
Code: [Select]
ucMessage[ MSG_CONTENT_LENGTH ] = ucLength+2;
fnWrite(INTERNAL_ROUTE, ucMessage, HEADER_LENGTH + ucLength + 2); // pass the message to the destination task
Then my-first-task like this
Code: [Select]
while (fnRead( PortIDInternal, ucInputMessage, EADER_LENGTH)) {
ucLength = fnRead( PortIDInternal, ucInputMessage, cInputMessage[MSG_CONTENT_LENGTH]);
I'm not exactly sure why I need +2, instead of +1. I think it's because the example didn't need to copy the '/0', where I'm looking for that. With out it, I would read old junk data from prior usage.

Spot on again. Thanks. I've got another one though.

I browse to which causes fnHandleWeb to run my newly created case 'J'. Which twice calls fnWrite(INTERNAL_ROUTE, ucMessage, HEADER_LENGTH + ucLength+2); // pass the message to the destination task

Both times it runs, INTERNAL_ROUTE is 0x00 and HEADER_LENGTH + ucLength+2 is 0x000d. ucMessage looks like this the first time through.

then the the second time through

Then in my-frist-task.c I hit this line twice as expected.

while (fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH)) {
   ucLength = fnRead( PortIDInternal, ucInputMessage, ucInputMessage[MSG_CONTENT_LENGTH]);

When stopped on the ucLength line, ucInputMessage looks like this on the first pass,

then like this on the second pass.

It appears like the second pass is rolling a bit. I expect 'E' in ucInputMessage[3] not ucInputMessage[0], so it appears for some reason the second time through it rolled down by 3 places. Perhaps I have to clean up some variable or memory between passes, I don't know at this point. Is this something that might jump out? Hmmm, could HEADER_LENGTH + ucLength+2 be wrong, I tried my best to eye ball that, but I don't really know if it's completely right. It seems like on the second pass in my-first-task, it only writes 5 characters as well. I'm not seeing why the second pass isn't giving me the message I expecting.

I've been working with the simulator, and I'm currently trying to get data in and out of my-first-task.c such that I can modify parameters in my-first-task.c via web browser. I think one of the better ways to do this is by passing messages from my case in webinterface.c. In my-first-task.c I have this section of code.

QUEUE_HANDLE PortIDInternal = ptrTaskTable->TaskID;
unsigned char ucInputMessage[MEDIUM_MESSAGE];

while (fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH)) {

On the first pass of that section, PortIDInternal is = 0, ucInputMessage has a bunch of junk in it, and HEADER_LENGTH = 4. In driver.c, when it tries to return from fnRead, it crashes with this message
Code: [Select]
Unhandled exception at 0x00000000 in uTaskerV1-4.exe: 0xC0000005: Access violation reading location 0x00000000.

I'm a bit baffled about what the problem could be. The return statement doesn't make a lot of sense to me. I expect that because it shouldn't have a message to read, it should return 0. Perhaps I'm doing something invalid with the HEADER_LENGTH?
"unhandled exception"

I'm having a bit of a problem when I run it on the target. I have a solid supply, or at least its solid at the board header. With a scope I measured both the 3.3v and 5v, neither appear to drop more than 10% even in short bursts, and both look very solid on the average, not noticeable ripple on the scope. A while back I had thought the problem was caused by slightly exceeding the power supply's limits, but it's now on a different supply that should be overly capable. When it fails, it locks up, the heartbeat LED stops blinking, ect. Most of the time it will come out of it by pressing the proto board's rest button, but not always. Sometimes I have to wait for 30 seconds or so and it self resets. Some times it runs for as little as 1 or 2 seconds, and it rarely lasts longer than 15 seconds.

I don't have much for external or extra devices attached to it. I have two SSR's that draw about 1.5ma each (pin spec is 4ma max), the AIS226 chip, then the typical eth and 232 wires. That's about it. I can't help but feel it has to be software related. I found an Older demo firmware titled uTaskerV1.3_Olimex_LPC2378-STK.hex it seems to work fine. Just blinks an LED.

I'm a bit baffled about how to figure out why it's locking up. I have the Olimex ARM-USB-OCD jtag device, so perhaps I can diagnose it with the jtag. Not sure. Any suggestions would be appreciated. I guess for now I'll keep playing with it in the simulator, but it would be nice to get real raw data.

It works works spot on that way. I formated the string a bit and now I can process raw data via spread sheet, or other number crunching mechanisms.

I believe I see what your saying, but I'm not sure it's quite what I need. I tired a couple more attempts, but no dice yet. I think this will help show the problem. I have been trying several things like using static, vs extern, vs not specified. This is how it is now, and I think this may show the problem.

In my-first-task.c
Code: [Select]
#define _INCLUDE_AIS226
#include "../../hardware/LPC23XX/spi_acc_lpc_AIS226_2.h"  // AIS226 accelerometer
#undef _INCLUDE_AIS226

blah blah blah

y_now = (signed short)  fnSPI_AIS226(OUTY_L, SPI_READ, 0x00)
  + (signed short)((fnSPI_AIS226(OUTY_H, SPI_READ, 0x00) & HI_MASK) << 8);
In webinterface.c
Code: [Select]
#define _INCLUDE_AIS226
#include "../../hardware/LPC23XX/spi_acc_lpc_AIS226_2.h"  // AIS226 accelerometer
#undef _INCLUDE_AIS226

blah blah blah

y_now = (signed short)  fnSPI_AIS226(OUTY_L, SPI_READ, 0x00)
      + (signed short)((fnSPI_AIS226(OUTY_H, SPI_READ, 0x00) & HI_MASK) << 8);
In spi_acc_lpc_AIS226_2.h
Code: [Select]
#if defined _INCLUDE_AIS226 // include AIS chip
unsigned char fnSPI_AIS226(unsigned char cmd, unsigned char rw, unsigned char SPI_data){
unsigned long temp;
int temp2, null;

blah blah

return temp2;

#endif // stop including AIS chip
fnSPI_AIS226 is a function that sends 8 bits down the SPI and receives 8 bits from the SPI. Because I'm using it as my comm interface, I'm looking to call it from different c files as a kind of shared function. I tried using the #define and #undef to help limit the scope of when it's seen by the compiler, but it still complains "webInterface.obj : error LNK2005: _fnSPI_AIS226 already defined in my-first-task.obj"

I had expected that it would compile spi_acc_lpc_AIS226_2.h into an object file, as well as my-first-task.c and webinterface.c into their own object files. I expected my c file(s) would simply list a jump command in the object file and it would all come together during linking. But it appears it compiles a bit more literally. I understand that the #include will simply copy the specified file, replacing the include line when it's made into the object file. But I thought it would be a bit less literal than that. I was expecting it would copy just the jump command to the function, not the entire function.

I believe I would normally get around this by modifying my make file to specifically compile the .h file into the .o file, then I would make sure this .o file was a dependent of my-first-task and webinterface. It would then be included while linking and my functions would all pull together in the last compile step.

I'm having some trouble getting my code to work under webinterface.c. originally I had the SPI comm routine(s) in spi_acc_lpc_AIS226_2.h and #included in my-first-task.c. When I use that same #include in webinterface.c I get complaints from the linker that it's defined twice.
Code: [Select]
webInterface.obj : error LNK2005: _fnSPI_AIS226 already defined in my-first-task.obj
I'm a bit ignorant about exactly how Vissual C++ will compile this part. It appears it will compile anything listed in the solution explorer.

I put spi_acc_lpc_AIS226_2.h next to spi_flash_lpc_stmicro.h in the solution explorer, and I tried to mimic similar programming techniques. I don't know why it keeps trying to define them twice, I might guess I'm doing something wrong with the .h file. It includes prototype(s), #defines, then the functions themselves. I don't know how to modify the compile process to make them show up as a file that is referenced by both my-first-task and the .h file. Are there any suggestions on how to fix it. I can provide additional information if required, but I don't know what pieces of information might be wanted for looking at. Are there any chunks of information I can provide to help diagnose this issue?

I'm looking to add two things to this proto board. One is to get a stream of the SPI data into a comma delimited file via HTTP, the other is to display the data on a web page.

To get a 1kb file on the PC it appears that I'm best off using £H20 instead of £H10 and creating a if statement like this under webinterface.c.
Code: [Select]
#ifdef HTTP_DYNAMIC_CONTENT                                              // {5}
        case 'H':

blah blah blah

else if (*ptrBuffer == '2') {
Is that the intended place for me to add such an item, or should I add this somewhere else similar to how I added it somewhere else like with my_first_task.c? 

I seem to recall seeing something that described the characters used in HTML parsing. Something that give a brief description of what these characters are and do.
Code: [Select]
£sO1Does such a document exist? I see there are several designators like that s, and a look up chart would be kind of handy. I've read the dynamic content generation document.

That's quite interesting. I can live with those constraints and I'm happy to have those performance enhancements at my finger tips. Thanks for the informative PDF.

I feel a bit sheepish. I used the Copy_all.bat file and it copied just fine. When I copy the files, then use dir via FTP, it replies with just the first letter of the uploaded file. I would guess the upload process renames the files when they get there. When I copied via explorer, I had it copy both ftp.txt and ftp_del.txt which would both get renamed to f.txt. I believe that's the point where it lost its brains. I can get the stack info if you would like for diag purposes. I'm back up and running, and it would appear using the command line ftp is a reliable solution, so I'll go with it. At this point I should be able to start experimenting with getting a stream of data from the AIS226 chip.

It appears I had a half crashed windows. Wireshark indicated I wasn't sending http traffic to the device IP. After the reboot, it now produces the expected 404. Even better when I transfer files it got about 15k of the file copied out of an expected 25k. Then it produced this message.

Unhandled exception at 0x004a3d13 in uTaskerV1-4.exe: 0xC0000005: Access violation writing location 0x00000000.

It brings me to line 346 of LPC23XXSIim.c. I think this means it ran out of memory. I'm not sure what memory might be small, or how to make an adjustment to it.

I'm now trying to use the dynamic http stuff such that I can stream a bunch of data from the AIS226DS chip. I have been trying to follow the uTaskerV1.4_LPC2XXX.PDF and I'm at the part where I expect to browse to and get a 404 message. However Chrome reports this.

Error 102 (net::ERR_CONNECTION_REFUSED): Unknown error.

Firefox and IE note the page can't be displayed. When I browse to I get this.

favicon.ico   1150 B   5/1/09 1:00:00 AM

I have tried uploading the pages as noted in the pdf, but I can't get FTP to upload. I have tried LeechFTP, Explorer, and a variety of browsers. They will show it, but what I try to upload I get via leechftp, I get this log.

~ Connected to, waiting for response...
< 220 Welcome LPC23XX FTP.
> USER anonymous
< 331 Enter pass.
> PASS *****
< 230 Log OK.
> REST 1
< 500 What?.
< 215 UNIX Type: L8
< 257 "/"
~ Login completed.
> PORT 10,10,10,10,12,200
< 200 OK.
< 200 OK.
< 150 Data.
< LISTERROR: -r-xr-xr-x 1 502 502 1150 May 1 2009 favicon.ico
< 226 OK.
< 200 OK.
< 200 OK.
> MKD adf
< 500 What?.
> PORT 10,10,10,10,12,219
< 200 OK.
< 200 OK.
< 150 Data.
< LISTERROR: -r-xr-xr-x 1 502 502 1150 May 1 2009 favicon.ico
< 226 OK.

When I try to create a directory with Explorer, it produces a dialog that notes "500 What?".

I have disabled the local software firewall, and I have commented out HTTP_UTFAT and FTP_UTFAT I'm not sure why it doesn't produce the 404 page as expected, and I'm unsure why the FTP is giving me trouble. Are there any suggestions on how to get this web page stuff working?

Pages: [1] 2 3 ... 5