Author Topic: AIS226DS / MOD-SMB380 I2C evaluation on LPC2378-STK  (Read 99176 times)

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
AIS226DS / MOD-SMB380 I2C evaluation on LPC2378-STK
« on: February 17, 2010, 11:49:44 AM »
I'm new here and currently reading the tutorials ect about how to use utasker. I've submitted my request for a hobby copy of utasker and should have that shortly. My first goal with utasker is to evaluate the MOD-SMB380 I just got from Olimex. I got this accelerometer because I found the on-board accelerometer had some noise issues.

So my first goal is to simply interface with the I2C and get accelerometer data out of this MOD board. I believe the digital interface of this chip will remove what I believe was analog noise issues with the original accelerometer. I'm curious if anyone one might have a recommended approach for this. I'm not sure if it's easier to get this data to show on a web page generated by utasker, or perhaps I can simply get it to display on the LCD. I'm still reading the docs and tutorials, so I'm very blind about what approach might be easiest.

I'm connecting it to an LPC2378-STK, and I can program / debug with ARM-USB-OCD both jtag and flash magic. I'm using the pre-configured windows based Eclipse and arm-elf-gcc that came with the 2378 board.

Thanks in advance.
« Last Edit: May 18, 2010, 10:58:00 AM by kb1gtt »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3232
    • View Profile
    • uTasker
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #1 on: February 17, 2010, 03:27:55 PM »
Hi Jared

Welcome to the forum - you should have received the project now so good luck with your first steps.

Start by following the tutorial using the simulator then move to your target - once you are happy with the project running there too you can activate I2C support and add the control for your specific device. Use the I2C document as guide (the accelerometer control will need to be added by setting its I2C address and sending the necessary specific commands but the basic interface should make this more comfortable - the references for EEPROM and RTC devices can be used as starting point).

The tutorial and project show how it is quite easy to interact with a web browser or else it also has some graphic support to allow you to display information on the LPC2378-STK's graphic display. Check out the uGLCDLIB in case you want to go this way: http://www.utasker.com/docs/uTasker/uTaskerLCD.PDF

Regards

Mark

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #2 on: February 18, 2010, 02:47:22 AM »
Great, I got the zip file and I'm currently downloading Visual Studio. That's going to take a while, it's a big file.

I'm reading the PDF's and getting familiar with this setup. Thanks and I look forward to jumping into this.

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #3 on: February 18, 2010, 02:58:11 AM »
I'm also new to Visual Studio. The I see the express comes in several variants, I'm think I want the C++ express. Is that correct? I can choose visual basic, C#, ect.

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #4 on: February 18, 2010, 08:19:11 AM »
Yes you want the C++ variant.

Cheers

Martin

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #5 on: February 18, 2010, 12:32:21 PM »
Things where going great, then I hit a mild hiccup and ran out of time to play with it this morning. I suspect my current ping hiccup isn't a huge deal.

It appears the express C++ version is around 100 to 200 megs. That downloaded just fine last night. I had originally thought I had to get the trail VS, which is a couple gigs. So I'm golden with VS now.

It took me a couple minutes to find preprocessor starting at pull down project --> uTasker properties --> configuration properties --> c/c++ --> preprocessor. I then saw this line "WIN32;_WINDOWS;_LPC23XX;ETHEREAL" which includes the _LPC23XX that I was looking to confirm. So I'm golden.

I changed the simulation IP to 10.10.10.3. Here's my ping attempt.

Code: [Select]
C:\>ping 10.10.10.3

Pinging 10.10.10.3 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 10.10.10.3:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\>ipconfig

Windows IP Configuration


Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 10.10.10.10
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.10.10.111

Also I set the simulation to look at my eth card that is used for my normal ether net activity. Here's my application.c.

Code: [Select]
static const NETWORK_PARAMETERS network_default = {
    (AUTO_NEGOTIATE /*| FULL_DUPLEX*/ | RX_FLOW_CONTROL),                // {42} usNetworkOptions - see driver.h for other possibilities
    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},                                // ucOurMAC - when no other value can be read from parameters this will be used
    { 10, 10, 10, 3 },                                                  // ucOurIP - our default IP address
    { 255, 255, 255, 0 },                                                // ucNetMask - Our default network mask
    { 10, 10, 10, 1 },                                                  // ucDefGW - Our default gateway
    { 10, 10, 10, 111 },                                                  // ucDNS_server - Our default DNS server
};

I ran out of time, I might guess that that firewall is blocking traffic. I see the red an green lights on the simulation blink. Also I see it notes IP 10.10.10.3, so it appears it compiled in the new IP. Perhaps I have to assign a MAC to the simulation. Typically when my firewall has an issue, it will pop up a message inquiring if it should block or allow the traffic. I ran out of time this morning, so I'm a little blind about what the issue might be.

Any words of wisdom about this ping thing?
« Last Edit: March 08, 2010, 11:32:43 AM by kb1gtt »

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #6 on: February 19, 2010, 03:00:59 AM »
Turns out my software firewall was blocking the ping ICMP data. It also appears that I have to disable the firewall to allow port 80 to pass through. Seems my PC is set to not operate as a gateway, and that type of traffic is blocked.

Now my problem is with the web page. I can get that orange 404, and I've got what appears to be a successful list of comments from the Copy_all.bat file. However, the simulation is still serving the 404 pages. I'd tried this with crtl, alt and shift reload, to flush the cache. No luck. Well it's off to bed tonight. I'm sure tomorrow with be filled with more delights. From what I've seen of this software, it's great.

Here's a snippet from my copy sequence.

Code: [Select]
drwxr-xr-x 1 502 502 0 Jan 03 2010 dir1
-rw-r--r-- 1 502 502 2219 Jan 00 1980 bmenu.htm
-rw-r--r-- 1 502 502 1146 Jan 00 1980 CTFT.htm
-rw-r--r-- 1 502 502 1689 Jan 00 1980 jstats.htm
-rw-r--r-- 1 502 502 2600 Jan 00 1980 dlan.htm
-rw-r--r-- 1 502 502 2007 Jan 00 1980 fback.jpg
-rw-r--r-- 1 502 502 3077 Jan 00 1980 HI_O.htm
-rw-r--r-- 1 502 502 2339 Jan 00 1980 kserial.htm
-rw-r--r-- 1 502 502 2365 Jan 00 1980 madmin.htm
-rw-r--r-- 1 502 502 1269 Jan 00 1980 ndynamic.htm
-rw-r--r-- 1 502 502 1723 Jan 00 1980 ohelp.htm
-rw-r--r-- 1 502 502 1534 Jan 00 1980 pemailse
-rw-r--r-- 1 502 502 30335 Jan 00 1980 hboard.jpg
-rw-r--r-- 1 502 502 2498 Jan 00 1980 2logo.gif
-rw-r--r-- 1 502 502 2603 Jan 00 1980 6_0menu.HTM
-rw-r--r-- 1 502 502 1114 Jan 00 1980 7LCD.htm
-rw-r--r-- 1 502 502 2600 Jan 00 1980 8lan.htm
-rw-r--r-- 1 502 502 2007 Jan 00 1980 alogo.jpg
-rw-r--r-- 1 502 502 2984 Jan 00 1980 CI_O.htm
-rw-r--r-- 1 502 502 1687 Jan 00 1980 estats.htm
-rw-r--r-- 1 502 502 2340 Jan 00 1980 fserial.htm
-rw-r--r-- 1 502 502 2268 Jan 00 1980 hadmin.htm
-rw-r--r-- 1 502 502 1338 Jan 00 1980 imultabl
-rw-r--r-- 1 502 502 1584 Jan 00 1980 jhelp.htm
-rw-r--r-- 1 502 502 1548 Jan 00 1980 kemailse
-rw-r--r-- 1 502 502 0 Jan 03 2010 imultabl
-rw-r--r-- 1 502 502 1338 Jan 00 1980 imultabl
-rw-r--r-- 1 502 502 1548 Jan 00 1980 kemailse
-rw-r--r-- 1 502 502 1338 Jan 00 1980 imultabl
-rw-r--r-- 1 502 502 1548 Jan 00 1980 kemailse
226 OK.
ftp: 1460 bytes received in 0.39Seconds 3.74Kbytes/sec.
ftp> quit
221 Bye

C:\uTaskerV1.4_LPC\Applications\uTaskerV1.4\WebPages\WebPagesLPC23xx\WebPagesDemo>

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3232
    • View Profile
    • uTasker
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #7 on: February 19, 2010, 03:45:47 AM »
Hi

I see your problem. The project is using a simulated SD card (define SDCARD_SUPPORT in config.h) and the defines FTP_UTFAT and HTTP_UTFAT are also active.
This means that any data copied via FTP is going to the SD card into the root directory.
When the web server is serving data it is looking for it relative to its root directory HTTP_ROOT              "dir1" on the SD card.

This means that there needs to be a directory called "dir1" and a start page called DEFAULT_HTTP_FILE      "index.htm" in that directory or else it reports a 404 error.

What you are seeing via FTP are all the files that have been copied to the simulated SD card. This doesn't match the tutorial so will be rather confusing.


Therefore I would do the following:
- either disable SDCARD_SUPPORT
or
- disable HTTP_UTFAT and FTP_UTFAT

The second will allow FTP and the HTTP servers to work with the uFileSystem in internal FLASH - as the tutorial describes. The SD card support will still be there so you can test that either using a virtual UART connection or with a TELNET connection. You will see that the files that you copied will still be there...

The SD card stuff is new (check out the patches at http://www.utasker.com/forum/index.php?topic=792.0) and confuses the tutorial if enabled, but it is good fun to test with the simulator and, once you are feeling comfortable with its workings, can be used to serve huge web side content from!!

Regards

Mark

P.S. The utFAT is described in http://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF


Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #8 on: February 19, 2010, 12:21:46 PM »
You hit that right on the head. I disabled the SD card and off it went. I finished the tutorial. I changed Build_LPC23XX.bat to include this line SET PATH=%PATH%;C:/gccfd/yagarto/bin which matches the yagarto gcc install I got from the default Olimex install. Compiled just fine and I was off to the races. I'm currently experiencing some mild power supply issues. Perhaps a ground loop with the USB and Ethernet or something like that. I'm currently powering this off the 5V ARM-USB-OCD device. I let someone use my bench supply, and I plan to pick that up this evening. With luck I'll have that power supply straightened out and I'll be back in business.

One thing that struck me as odd. I made a brief attempt at the GLCD thing. I defined SUPPORT_GLCD which failed with an error message. I then commented out CGLCD_GLCD_MODE and defined NOKIA_GLCD_MODE. Here's my application.c snippet.

Code: [Select]
//#define SUPPORT_LCD 

blah

#define SUPPORT_GLCD                                                   // enable the task for interfacing to a graphical LCD
#if defined SUPPORT_GLCD
    #define BIG_PIXEL                                                    // display double size in the simulator
  //#define OLED_GLCD_MODE                                               // use an OLED in GLCD compatible mode
  //#define TFT_GLCD_MODE                                                // use a TFT in GLCD compatible mode
    #define NOKIA_GLCD_MODE                                              // use Nokia 6100 LCD in compatible mode
    //#define CGLCD_GLCD_MODE                                              // use colour LCD in GLCD compatible mode

I compiled with the simulator compile process, and got this error message.

Code: [Select]
LPC23XX_ports.cpp
Linking...
GLCD.obj : error LNK2001: unresolved external symbol _CollectCommand
.\Debug/uTaskerV1-4.exe : fatal error LNK1120: 1 unresolved externals
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 9.00.30729
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://c:\uTaskerV1.4_LPC\Applications\uTaskerV1.4\Simulator\Debug\BuildLog.htm"
uTasker - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I took a quick look at uTaskerLCD.PDF, and at least on a quick scan, nothing special jumped out at me. The build log basically tells me it built a bunch of stuff. Perhaps I need to define something. Not sure at this point. I ran out of time while looking for where this GLCD.obj object is being created. I see TFT.c and LCD.c, but no GLCD.c. Should I have a file like that?

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3232
    • View Profile
    • uTasker
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #9 on: February 19, 2010, 12:55:48 PM »
Hi

The GLCD problem looks like a strange thing with the new Visual Studio version(s). The missing routine is coming from the LCD simulator and it means that VS hasn't recompiled this file.

If you command a re-build (or clean) rather than just a build it will force it to recompile all files in the project and afterward it should work.

Regards

Mark

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #10 on: February 20, 2010, 02:40:51 AM »
Works great. I had to clean both the debug build, and the gnu build. I now see exactly the same thing on the LCD as I do in the simulation. Looks good.

With some luck, I'll be able to start the I2C tutorials on Sunday.

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #11 on: February 24, 2010, 12:15:54 PM »
Now that I've wondered through the initial demo, I'm starting to play with GLCD stuff such that I can get live data out of the device, then eventually I can get I2C data out of the device.

I'm trying to follow the GLCD code, but I'm having trouble. I think I should find the demo code in application_lcd.h. On the LCD screen I see some the text "tasker glcd" and it's only found in this header file. Sounds good, however, the section is grey and it won't let me add a break point. I believe it's gray because it requires an OLED define. I didn't define that because I don't have an OLED display. So this running demo code has to be somewhere else. When I look up and down this file, it's basically all grey. Indicating that the demo code is coming from a different file. By searching for NOKIA_GLCD_MODE I think I see the code in the LCDSim.cpp file.

To me it seems like there is probably a define some where that I should uncomment to make it run a different chunk of code. I don't think I should be modifying the LCDSim code. I tried creating a define for HANDLE_LCD_MESSAGES such that it would run the code under application_lcd.h, but no dice.

Any thoughts on how to get a chunk of LCD code where I can add or modify strings of data?

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3232
    • View Profile
    • uTasker
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #12 on: February 24, 2010, 01:55:56 PM »
Hi

All code to do with the GLCD demo is in application_lcd.h. I wouldn't always trust the VS display of defined code.

The way that it works is:
1) When the GLCD is completely initialised the code handles the event E_LCD_INITIALISED. In the demo this writes some text "Welcome to the" + "uTasker GLCD demo!" + "Starting..." [if this is appearing on the display of the simulator or the real target this will certainly be taking place].
2) Since an ACK was requested when the last text has been displayed the second event is E_LCD_READY.
This starts a 1s timer and its event, E_NEXT_PIC, starts the state-machine which continuously displays different pictures and then shapes, and finally scrolling fonts.

In order to use the LCD for other work simply do the following:

1) Remove the code in E_LCD_INITIALISED so that the demo is not started.
2) React to E_LCD_INITIALISED as you prefer - eg. to display your logo or your own welcome text.
3) Either use the ACK method to send further data or else simply send new text as you want to - in this case ensure that the LCD task's input queue is large enough to hold as much text as you send to it during the text processing and LCD writing (the LCDs are sometimes a bit slow to write to - although the NOKIA is quite fast and doesn't get polled). The task's input queue length is defined in TaskConfig.h.
In some cases a mixture of writing at any time and waiting for acks may be useful, but that depends on the application. (The idea of the ACK is that it allows a minimum LCD task queue since a new command/picture/text can be sent only after the LCD task acknowledges that the previous command has been fully completed).

With a small amount of practice you should find working with the LCD quite easy and flexible.

Regards

Mark

Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: MOD-SMB380 I2C evaluation on LPC2378-STK
« Reply #13 on: February 25, 2010, 02:23:49 AM »
What do you know, even though it's grey, I can add break points to that section. Also when I change it, the text on the screen changes. Seems like I'm back up and running. That should keep me occupied for a bit. Thanks.


Offline kb1gtt

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: AIS226DS SPI evaluation on LPC2378-STK
« Reply #14 on: March 07, 2010, 03:40:08 PM »
I think it's time to start my next step. In this case, I'm looking to get data out of a chip using utasker's SPI capabilities, then display a number on the lpc2378stk LCD.

I have changed the plan some from what I mentioned above. I was looking to evaluated the MOD_SMB380 accelerometer from Olimex. I now have a better accelerometer in the works. So I guess I'll change my plan to work with that one. This new board is being assembled from a fellow that works at Sparkfun. Sparkfun tech support suggested him, and he been great to work with while making this breakout board. I believe he'll put these boards up for sale when they are done, so I'll put in a plug for him, if anyone is interested. He's posting the schematics and such, they can be found here.

http://www.aamicron.com/_jh_aamicron_proto_v10.html

It uses the AIS226DS from STmicro. Here's a link to it's data sheet.

http://www.st.com/stonline/products/literature/ds/15164/ais226ds.pdf

The AIS chip is currently set at evaluation status by STmicro, and is up for normal release in Q1 of 2010. ST was kind enough to send me samples for development purposes. It's a 14 bit .25mg/bit resolution 2 and 6 g scale SPI digital 2 axis accelerometer. This break out board is designed to work with Olimex's SPI bus on the Uext connector. However, it is also being setup such that it can be bread-boarded or other. It's a fairly flexible layout.

I looked over the flash tutorial, and I read the other thread where seulater was working with a 2378 and SPI. I don't have a flash device to experiment with, but with luck will have the AIS board in about a month perhaps less. Now that it's time for me to hurry up and wait, I figured it's time to start drafting code to read data from the AIS chip via SPI. I've already played with the LCD, so I feel confident I'll be in good shape for displaying this info once I get it out of the chip.

Are there any suggested SPI starting points that might be nicer than others? Perhaps there are already generic SPI read / write commands available that I'm not familiar with. From the PDF's I was thinking of copying parts of the SPI boot-loader, modifying them to get the right packet structure for the AIS chip. However, it feels like I might overlook something and wipe out the program. Perhaps there is an easier starting point.