Reading and transmitting accelerometer values

Thanks! You wrote “transmit the accelerometer values to your computer” and I thought that meant wirelessly transmitting to the computer (I don’t need that :smiley:)
I was wondering why it’s necessary to use the radioQueue library if it’s less reliable than the RadioCom library. I only want communication between two Wixels.

I’m not totally sure if using radioQueue was best choice, but there was another customer who contacted us and wanted to do this with two transmitters so that’s what I chose.

–David

I am having trouble compiling the wireless_adc_rx app. I did “clean” and “build all” in Eclipse and the .wxl app file wasn’t created. I named the file “receive_test.c”. This is the console window output:

The #include <radio_queue.h> is in the program so I don’t know why I’m getting these errors.

If you get ASlink-Warning-Undefined Global it means that the link step is failing, so your #include statements don’t really matter.

Did you download the latest version of the Wixel SDK? In general that would be the best thing to do because some of the libraries may have changed and the new app might depend on those changes. In this specific case I don’t think it matters. If you didn’t download the latest version of the Wixel SDK, did you remember to copy the options.mk file for that app?

–David

ahh thanks, I wasn’t aware of the options.mk file…the build works fine now!

I’m trying to combine the wireless_adc_rx app with the servo control code. I created a new folder with a new file and I’m getting an error when I include the “options.mk” file:

I’m puzzled by this…I copied the options.mk file into the new folder. I also created a new options.mk file and pasted the code in but that still didn’t work.

That is an interesting error. Please post the contents of apps/receive_test/receive_test.d here. It is a text file so you can open it with Notepad, then copy and paste.

Just in case there is a problem with your options.mk file, please post that file here too.

–David

This is the content of apps/receive_test/receive_test.d:

apps/receive_test/receive_test.rel: apps/receive_test/receive_test.c \
 libraries/include/wixel.h libraries/include/cc2511_types.h \
 libraries/include/cc2511_map.h libraries/include/board.h \
 libraries/include/time.h libraries/include/dma.h libraries/include/adc.h \
 libraries/include/gpio.h libraries/include/random.h \
 libraries/include/usb.h libraries/include/usb_com.h \
 libraries/include/com.h libraries/include/radio_queue.h \
 libraries/include/radio_mac.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/stdio.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/stdarg.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/sdcc-lib.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/asm/mcs51/features.h

libraries/include/wixel.h:

libraries/include/cc2511_types.h:

libraries/include/cc2511_map.h:

libraries/include/board.h:

libraries/include/time.h:

libraries/include/dma.h:

libraries/include/adc.h:

libraries/include/gpio.h:

libraries/include/random.h:

libraries/include/usb.h:

libraries/include/usb_com.h:

libraries/include/com.h:

libraries/include/radio_queue.h:

libraries/include/radio_mac.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/stdio.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/stdarg.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/sdcc-lib.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/asm/mcs51/features.h:

This is the content of the options.mk file:

APP_LIBS := dma.lib radio_mac.lib radio_queue.lib radio_registers.lib random.lib usb.lib usb_cdc_acm.lib wixel.lib gpio.lib adc.lib 

sorry to jump on the band wagon bit I get the same problem sporadically

here’s my “.d” file

apps/mmcpFS/mmcpFS.rel: apps/mmcpFS/mmcpFS.c libraries/include/usb.h \
 libraries/include/cc2511_types.h libraries/include/usb_com.h \
 libraries/include/time.h libraries/include/cc2511_map.h \
 libraries/include/com.h libraries/include/radio_queue.h \
 libraries/include/radio_mac.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/stdio.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/stdarg.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/sdcc-lib.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/asm/mcs51/features.h \
 libraries/include/spi.h libraries/include/wixel.h \
 libraries/include/board.h libraries/include/dma.h \
 libraries/include/adc.h libraries/include/gpio.h \
 libraries/include/random.h libraries/include/sd.h

libraries/include/usb.h:

libraries/include/cc2511_types.h:

libraries/include/usb_com.h:

libraries/include/time.h:

libraries/include/cc2511_map.h:

libraries/include/com.h:

libraries/include/radio_queue.h:

libraries/include/radio_mac.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/stdio.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/stdarg.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/sdcc-lib.h:

C:/Program\ Files\ (x86)/SDCC/bin/../include/asm/mcs51/features.h:

libraries/include/spi.h:

libraries/include/wixel.h:

libraries/include/board.h:

libraries/include/dma.h:

libraries/include/adc.h:

libraries/include/gpio.h:

libraries/include/random.h:

libraries/include/sd.h:

and “’.mk”

APP_LIBS += radio_queue.lib spi.lib sd.lib

The .d files you both posted look good. Either there is a bug in Make, or there is something in some file that is telling Make that the bizzarre file name “x86)/SDCC/bin/…/include/asm/mcs51/features.h)” is a dependency of your .rel file. Somehow Make is removing “C:/Program Files (” from the name of the dependency, and adding a “)” at the end of the name of the dependency.

If something like the following line appeared anywhere in the Makefile, .mk, or .d files, it would explain the problem:

apps/receive_test/receive_test.rel: x86)/SDCC/bin/../include/asm/mcs51/features.h)

Does the problem go away if you run “make clean” (which removes all the important .d files)? Do you have a way to reproduce it reliably?

–David

make clean does what it says on the tin
then CTRL-B does another “make all” but this time it works
I found it seems to happen if I get a “page fault during linking” - i.e. the code or data segments are too big
then the next CTRL-B gives the weird error
hope that helps

if you need any other diagnostics - just shout

I’ll try deleting the .d file next time it happens

just to confirm
I changed a #define - which gives me a much bigger code segment - link fails
comment out the define
recompile - bang “no rule” error
renamed xxx.d to xxx.dold
recompile - works!

interestingly, the .d I deleted was for my spi library
spi.d: (that works)

libraries/src/spi/spi.rel: libraries/src/spi/spi.c \
 libraries/include/spi.h libraries/include/wixel.h \
 libraries/include/cc2511_types.h libraries/include/cc2511_map.h \
 libraries/include/board.h libraries/include/time.h \
 libraries/include/dma.h libraries/include/adc.h libraries/include/gpio.h \
 libraries/include/random.h libraries/include/usb.h \
 libraries/include/usb_com.h libraries/include/com.h
libraries/include/spi.h:
libraries/include/wixel.h:
libraries/include/cc2511_types.h:
libraries/include/cc2511_map.h:
libraries/include/board.h:
libraries/include/time.h:
libraries/include/dma.h:
libraries/include/adc.h:
libraries/include/gpio.h:
libraries/include/random.h:
libraries/include/usb.h:
libraries/include/usb_com.h:
libraries/include/com.h:

spi.d: (that fails)

libraries/src/spi/spi.rel: libraries/src/spi/spi.c \
 libraries/include/spi.h libraries/include/wixel.h \
 libraries/include/cc2511_types.h libraries/include/cc2511_map.h \
 libraries/include/board.h libraries/include/time.h \
 libraries/include/dma.h libraries/include/adc.h libraries/include/gpio.h \
 libraries/include/random.h libraries/include/usb.h \
 libraries/include/usb_com.h libraries/include/com.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/stdio.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/stdarg.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/sdcc-lib.h \
 C:/Program\ Files\ (x86)/SDCC/bin/../include/asm/mcs51/features.h
libraries/include/spi.h:
libraries/include/wixel.h:
libraries/include/cc2511_types.h:
libraries/include/cc2511_map.h:
libraries/include/board.h:
libraries/include/time.h:
libraries/include/dma.h:
libraries/include/adc.h:
libraries/include/gpio.h:
libraries/include/random.h:
libraries/include/usb.h:
libraries/include/usb_com.h:
libraries/include/com.h:
C:/Program\ Files\ (x86)/SDCC/bin/../include/stdio.h:
C:/Program\ Files\ (x86)/SDCC/bin/../include/stdarg.h:
C:/Program\ Files\ (x86)/SDCC/bin/../include/sdcc-lib.h:
C:/Program\ Files\ (x86)/SDCC/bin/../include/asm/mcs51/features.h:

I ran “make clean” and the build still produced that error…

For some reason it works now and creates the .wxl file. I’m still getting this error from before in the console window:

It still works though!

mmcp42,

Can you verify that you are running our version of Make? The command “make -v” should include “3.82-pololu1” in the output.

Here’s how the .d files work: They are generated whenever SDCC compiles the corresponding .rel file. Then the next time you run make, make will use the information in the .d files to tell whether or not the rel file needs to be recompiled, but if make has trouble processing the .d file it could cause the error you are seeing. This explains why the first “make all” after a “make clean” would succeed, but the second “make all” might fail. Is this what is happening for you?

I have tried various ways to reproduce the problem you are having here but I was not able to. For example, I added “include <stdio.h>” to the usb library’s “green_led.c”. It resulted in a .d file that looked very similar to yours (except for double-spacing between the lines and capitialization of C:), but I did not get the errror. I tried to building apps that took up too much Flash or RAM to fir the Wixel, but I did not get the error.

The next time you have the problem, could you please send me a complete copy of your entire wixel-sdk so I can try compiling it here with exactly the same files you have on your computer? Feel free to remove any code you don’t want to give away, as long as the error still happens after that code has been removed. In fact, the more you can simplify the SDK, the better, because it will help locate the problem.

–David

make is indeed 3.82

GNU Make 3.82-pololu1
Built for Windows32
Copyright (C) 2010  Free Software Foundation, Inc.
Modified by Pololu <https://www.pololu.com>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I removed the blank lines to take up less screen space when I posted my .d

after a make all, it seems to stay fixed, until it goes wrong again, if that makes sense
next time it falls on it’s face I’ll bundle it up for you
happy to send it to you by email
don’t really want to dump my life on the forum!

cheers
Mike

Okay great. You can send it to me at david (at) pololu.com.

–David

I have a question about the wireless receive app. Where is rxPacket defined? I want to use the value read from P0_0 in my program and I tried this:

if((rxPacket->readings[0]) < 1448)
            	{
        			pwmPulse = 16;
            	}

which gives this error:

Compiling  apps/wireless_servocontrol/servocontrol.rel
apps/wireless_servocontrol/servocontrol.c:114: error 20: Undefined identifier 'r
xPacket'
apps/wireless_servocontrol/servocontrol.c:114: error 27: Pointer required
apps/wireless_servocontrol/servocontrol.c:114: error 44: compare operand cannot
be struct/union
comparing type voidto type const-int literal

Are you talking about the wireless_adc_rx app? If so, the rxPacket pointer is defined in wireless_adc_rx.c in radioToUsbService().

–David

Thanks, yes in the wireless_adc_rx app I see how the rxPacket pointer is defined through “adcReport XDATA * rxPacket” but I’m confused about how the values in the structure are set.
I’m still getting the same error with the if statement after trying typecasting: " if((rxPacket->readings[0]) < (uint16)1448)".

The data gets stored in RAM by the radioQueue library when a packet is received from another Wixel. The rxPacket pointer is assigned to point at those values on the very next line after it is defined:

if ((rxPacket = (adcReport XDATA *)radioQueueRxCurrentPacket()) && usbComTxAvailable() >= 64)

–David