UofA-BAJA / 2022-2023

This is the codebase for the University of Arizona BAJA Electrical Team, year 2022/2023
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Configure LoRa GPS board to act as slave and send data to Raspberry Pi when requested #15

Closed queball1999 closed 1 year ago

queball1999 commented 2 years ago

I want to be able to ask the GPS module for data using the Raspberry Pi. That way we can parse this data on the Pi and pack it in with the rest of the data, which will be transmitted to the ground station.

We first want to configure the LoRa GPS board with a method of transmission, TX/RX, or I2C. Once we decide this, we want to make the LoRa GPS board send data when requested from the Raspberry Pi. We probably want to pack the data and send it from the LoRa GPS board, then depack it and parse it on the Raspberry Pi.

queball1999 commented 2 years ago

Cannot get the code to compile on CubeCell board:

*This happens on both Mac and PC

I have implemented I2C protocols in the code, but whenever I make 'Wire.onRequest()' or 'Wire.onReceive()' calls the code will not compile; it keeps giving me the following error:

undefined reference to TwoWire::onReceive(void (*)(int)) collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board CubeCell-GPS(HTCC-AB02S).

The following code is what I am currently using: #define MASTER_ADDRESS 0x04 ... void setup() { Wire.begin(MASTER_ADDRESS); Wire.onReceive(receiveEvent); Wire.onRequest(requestEvent); } ... void receiveEvent(int bytes) { Wire.read(); }

void requestEvent() { Wire.write('test') }

I am wondering if something is wrong with the code or if something is wrong with the board inside of the Arduino IDE. I did find a forum that talked about this issue and had possible solutions for Mac and Windows, but I was unsuccessful in getting it to work. The issue only happens when the calls to 'Wire.onRequest()' or 'Wire.onReceive()' are made.

queball1999 commented 2 years ago

After talking with Michael and doing a bit of research into the board, we may just implement Serial communication protocols instead of I2C. It seems like the OLED screen is using I2C, so the board has I2C, I just don't know why its not working.