Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MPU6050 Port
15-04-2015, 12:17 PM,
#1
MPU6050 Port
Hi

I'm working in a MPU6050 port for Pinguino. I was able to make it work in the past modifying the Arduino code in Microchip's C18 for a PIC18F46J50. 
I attach a video recorded some time ago.





I have made great strides in the MPU6050 port for Pinguino, but I failed to compile the code. I'm not familiar with the sdcc compiler.
The errors suggest that the library MPU6050 is not included and that the compiler can't find the symbol definition for some functions, but I have checked twice and everything seems alright.
I attach the stdout output

Code:
error: Missing definition for symbol "_setZGyroOffset", required by "C:\pinguino-11\user\source\main.o".

error: Missing definition for symbol "_setYGyroOffset", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_setXGyroOffset", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_getIntStatus", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_setZAccelOffset", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_dmpInitialize", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_initialize", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_testConnection", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_dmpGetFIFOPacketSize", required by "C:\pinguino-11\user\source\main.o".
error: Missing definition for symbol "_setDMPEnabled", required by "C:\pinguino-11\user\source\main.o".
Processor: 18f46j50
sdcc: Calling linker...
+ C:\PINGUI~1\COMPIL~1\p8\bin\gplink.exe -I"C:\pinguino-11\compilers\p8\bin\..\share\sdcc\lib\pic16" -I"C:\pinguino-11\compilers\p8\bin\..\share\sdcc\non-free\lib\pic16" -sC:\pinguino-11\p8\lkr\boot4.18f46j50.lkr -m -w -r -o "C:\pinguino-11\user\source\main.hex" "C:\pinguino-11\user\source\main.o" "libio18f46j50.lib" "libdev18f46j50.lib" "libc18f.lib" "libm18f.lib" "libsdcc.lib" "libdev18f46j50.lib" "libsdcc.lib"
+ C:\PINGUI~1\COMPIL~1\p8\bin\gplink.exe -I"C:\pinguino-11\compilers\p8\bin\..\share\sdcc\lib\pic16" -I"C:\pinguino-11\compilers\p8\bin\..\share\sdcc\non-free\lib\pic16" -sC:\pinguino-11\p8\lkr\boot4.18f46j50.lkr -m -w -r -o "C:\pinguino-11\user\source\main.hex" "C:\pinguino-11\user\source\main.o" "libio18f46j50.lib" "libdev18f46j50.lib" "libc18f.lib" "libm18f.lib" "libsdcc.lib" "libdev18f46j50.lib" "libsdcc.lib" returned errorcode 1
/dvpt/pinguino/git-copy/pinguino-compilers/sources/sdcc/src/pic16/main.c:701 setting interrupt vector addresses 0xc00

And finally, I attach the complete code.


.zip   MPU6050.zip (Size: 53.27 KB / Downloads: 8)

The implementation is imcomplete, this is the first sketch (You have to add the interrupt INT0). 

I hope that someone can halp me to develop this port. Together we can make it work!

Leonardo.
Reply
15-04-2015, 07:09 PM,
#2
RE: MPU6050 Port
Hi Leonardo,

The IDE doesn't (yet) support multi-file compilation. It compiles only main.c. So you have to include .c in your .pde if you want them to be compiled :

#include "I2Cdev.h"

#include "I2Cdev.c"
#include "MPU6050.h"
#include "MPU6050.c"

You will get a complete bugs report by pressing F9. Most of them are now easy to fix (Undefined identifier most of the time).

You will also see "Undefined identifier 'Serial'". This is because SDCC is a C compiler not a C++ compiler (read more) so you can't call Serial.print for example, you need to call its C equivalent : serialprint (see p8/pdl/serial.pdl for all equivalents). If you use the serial library in your code (I don't speak about the pde file because Pinguino libs are automatically included by the IDE see sources/define.h), don't forget to include it : #include <serial.c>.

Some types you used are not defined. Try to include <typdef.h> and use Pinguino type instead. Generally speaking it's a good idea to always include typedef.h, const.h and macro.h

Take care that some libs from you (I2Cdev for ex.) might already exist with a different syntax (i2c.c).

I will do my best to help you with that code.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
16-04-2015, 10:48 AM,
#3
RE: MPU6050 Port
Hi regis!

Thanks for your reply!
I will follow the suggested tips to modify the code, and as soon as I get positive results, I'll post the corrected code.
I hope to make some progress this weekend (Fingers crossed Tongue )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)