i am thinking of connecting a fona 3G modul to the Odroid-go to maybe make a call with it

Would that be possible?
Thanks
Code: Select all
#include <odroid_go.h>
#include <SoftwareSerial.h>
// On GPIO Connector fona RX is connected to pin4 and fona TX to pin5 - so this are the configs
#define FONA_RX 15
#define FONA_TX 4
SoftwareSerial fonaSerial(FONA_RX,FONA_TX);
void setup() {
//start go
GO.begin();
//print a first test hello
GO.lcd.println("Hello, ODROID-GO");
//start fona serial connection
fonaSerial.begin(4800);
//second test screen output
GO.lcd.println("Hello, ODROID-GO2");
// delay(1000);
//first check if serial is available
if (! fonaSerial.available()) {
//GO.lcd.clearDisplay();
GO.lcd.println("fona not found");
}
}
void loop() {
//check if we entered loop
GO.lcd.println("started");
//as soon as fona is available it should output on screen
if (fonaSerial.available()) {
GO.lcd.clearDisplay();
GO.lcd.println("fona found");
}
//wait between reloop
delay(5000);
}
Did not try to toggle this 2 pins but for the adafruit library there is a reset pin to be connected also. I have connected it with pin3 and i see the pin is triggered because fona restarts. So basic control over pins is there.odroid wrote:Can you toggle IO15/IO4(Pin4/Pin5) via normal GPIO access?
Vacnatz wrote:Heya, so you sure the pins you're using support change interrupts?
SoftwareSerial is depreciated at this point for main line arduino boards and it's interface is pretty bare bones, it only supports specific pins on specific microcontrollers.
Interruptable pins stop the arduinos loop and trigger actions whenever a specific actions is taken, i.e. a packet of data is recieved.
This is important in this case because i imagine there's a handshake that occurs between the fona and the fona library on the microcontroller when an interrupt is triggered.
altsoftserial is a more fully featured library and may give you the type of connection you're looking for as it supports interrupts, though depending on the other peripherals in the odroid it may not work
https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
Another option for you would to be to connect it to something with a ton of hardware serial ports, like a teensy, and use it as a rather extravagant go-between ie:
1. Odroid sends a dial message to a teensy (or other microcontroller w/interrupts) via a simple serial message
2. The teensy takes the dial message and formats/sends to the fona
3. The teensy then sends a serial flag back to the odroid, updating the current status of the fona so it can be displayed
It adds another board, but it might solve your issue...
In any case make sure the pins you're using support interrupts in software serial, the unos mapping will not directly translate to the esp32 especially with the other peripherals in it.
the interrupt thing is pretty explicit on the arduino software serial documentation, I know you're using a esp32 port, but it's a port of a port made for another esp board so milage may vary.
https://www.arduino.cc/en/Reference/SoftwareSerial
Dont be afraid to mess around in the library code either, it's built with arduino as well, so if it's referencing specific pins, you may be able to change it.
i had a similar issue with LEDs and an ATWINC board and interrupts were the primary culprit.
This is interesting. So there are 2 free uart available when i understand you right. So this would mean it should really work with hardserial. I just need to figure out howcrashoverride wrote:Using esp-idf, it should be possible to route a UART to the expansion header. The flash and PSRAM occupy the SPI peripheral which is not shared by UART on ESP32 as it is on other micro controllers. There should be (3) SPI and (3) UARTS. Only one of the UARTs should be reserved for the serial debug console.
Example UART code can be found here:
https://github.com/espressif/esp-idf/tr ... /uart_echo
All that should be required is to change the pin numbers to those used on the expansion port:
https://github.com/espressif/esp-idf/bl ... .c#L26-L27
The uart echo(loop-back) test with esp-idf works fine.crashoverride wrote:Using esp-idf, it should be possible to route a UART to the expansion header. The flash and PSRAM occupy the SPI peripheral which is not shared by UART on ESP32 as it is on other micro controllers. There should be (3) SPI and (3) UARTS. Only one of the UARTs should be reserved for the serial debug console.
Example UART code can be found here:
https://github.com/espressif/esp-idf/tr ... /uart_echo
All that should be required is to change the pin numbers to those used on the expansion port:
https://github.com/espressif/esp-idf/bl ... .c#L26-L27
Code: Select all
#include <stdio.h>
#include <driver/uart.h>
#define ECHO_TEST_TXD (GPIO_NUM_15)
#define ECHO_TEST_RXD (GPIO_NUM_4)
#define ECHO_TEST_RTS (UART_PIN_NO_CHANGE)
#define ECHO_TEST_CTS (UART_PIN_NO_CHANGE)
#define BUF_SIZE (1024)
uint8_t *data = (uint8_t *) malloc(BUF_SIZE);
void setup() {
// put your setup code here, to run once:
uart_config_t uart_config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
};
uart_param_config(UART_NUM_1, &uart_config);
uart_set_pin(UART_NUM_1, ECHO_TEST_TXD, ECHO_TEST_RXD, ECHO_TEST_RTS, ECHO_TEST_CTS);
uart_driver_install(UART_NUM_1, BUF_SIZE * 2, 0, 0, NULL, 0);
}
void loop() {
// put your main code here, to run repeatedly:
int len = uart_read_bytes(UART_NUM_1, data, BUF_SIZE, 20 / portTICK_RATE_MS);
// Write data back to the UART
uart_write_bytes(UART_NUM_1, (const char *) data, len);
}
Code: Select all
boolean Adafruit_FONA::begin(Stream &port) {
mySerial = &port;
pinMode(_rstpin, OUTPUT);
digitalWrite(_rstpin, HIGH);
delay(10);
digitalWrite(_rstpin, LOW);
delay(100);
digitalWrite(_rstpin, HIGH);
DEBUG_PRINTLN(F("Attempting to open comm with ATs"));
// give 7 seconds to reboot
int16_t timeout = 7000;
while (timeout > 0) {
while (mySerial->available()) mySerial->read();
if (sendCheckReply(F("AT"), ok_reply))
break;
while (mySerial->available()) mySerial->read();
if (sendCheckReply(F("AT"), F("AT")))
break;
delay(500);
timeout-=500;
}
if (timeout <= 0) {
#ifdef ADAFRUIT_FONA_DEBUG
DEBUG_PRINTLN(F("Timeout: No response to AT... last ditch attempt."));
#endif
sendCheckReply(F("AT"), ok_reply);
delay(100);
sendCheckReply(F("AT"), ok_reply);
delay(100);
sendCheckReply(F("AT"), ok_reply);
delay(100);
}
// turn off Echo!
sendCheckReply(F("ATE0"), ok_reply);
delay(100);
if (! sendCheckReply(F("ATE0"), ok_reply)) {
return false;
}
// turn on hangupitude
sendCheckReply(F("AT+CVHU=0"), ok_reply);
delay(100);
flushInput();
DEBUG_PRINT(F("\t---> ")); DEBUG_PRINTLN("ATI");
mySerial->println("ATI");
readline(500, true);
DEBUG_PRINT (F("\t<--- ")); DEBUG_PRINTLN(replybuffer);
if (prog_char_strstr(replybuffer, (prog_char *)F("SIM808 R14")) != 0) {
_type = FONA808_V2;
} else if (prog_char_strstr(replybuffer, (prog_char *)F("SIM808 R13")) != 0) {
_type = FONA808_V1;
} else if (prog_char_strstr(replybuffer, (prog_char *)F("SIM800 R13")) != 0) {
_type = FONA800L;
} else if (prog_char_strstr(replybuffer, (prog_char *)F("SIMCOM_SIM5320A")) != 0) {
_type = FONA3G_A;
} else if (prog_char_strstr(replybuffer, (prog_char *)F("SIMCOM_SIM5320E")) != 0) {
_type = FONA3G_E;
}
if (_type == FONA800L) {
// determine if L or H
DEBUG_PRINT(F("\t---> ")); DEBUG_PRINTLN("AT+GMM");
mySerial->println("AT+GMM");
readline(500, true);
DEBUG_PRINT (F("\t<--- ")); DEBUG_PRINTLN(replybuffer);
if (prog_char_strstr(replybuffer, (prog_char *)F("SIM800H")) != 0) {
_type = FONA800H;
}
}
#if defined(FONA_PREF_SMS_STORAGE)
sendCheckReply(F("AT+CPMS=" FONA_PREF_SMS_STORAGE "," FONA_PREF_SMS_STORAGE "," FONA_PREF_SMS_STORAGE), ok_reply);
#endif
return true;
}
/********* Serial port ********************************************/
boolean Adafruit_FONA::setBaudrate(uint16_t baud) {
return sendCheckReply(F("AT+IPREX="), baud, ok_reply);
}
Vacnatz wrote:https://learn.adafruit.com/adafruit-fon ... e?view=all
Your example doesn't make any of the settings calls or handshakes needed to operate the board.
Your code calls it quits if it doesn't detect an active serial port, but the fona requires you to send it a command first in order for it to respond with a serial message.
Do the adafruit tutorial.
If the arduino code doesn't accomplish the basics of what is required to operate the board, then the pin assignments have nothing to do with your issues.
Sorry, was a bit drunk yesterday :S All greenVacnatz wrote:No offence intended, apologies if my message was glib.
Your post did me point to what i needed. Thank you very much!lsc1117 wrote:The uart echo(loop-back) test with esp-idf works fine.crashoverride wrote:Using esp-idf, it should be possible to route a UART to the expansion header. The flash and PSRAM occupy the SPI peripheral which is not shared by UART on ESP32 as it is on other micro controllers. There should be (3) SPI and (3) UARTS. Only one of the UARTs should be reserved for the serial debug console.
Example UART code can be found here:
https://github.com/espressif/esp-idf/tr ... /uart_echo
All that should be required is to change the pin numbers to those used on the expansion port:
https://github.com/espressif/esp-idf/bl ... .c#L26-L27
I have tested with expansion GPIO4 and GPIO15 pin.
@mameise - You can also use the esp-idf framework in Arduino.
I attached the tested code below
Code: Select all
#include <stdio.h> #include <driver/uart.h> #define ECHO_TEST_TXD (GPIO_NUM_15) #define ECHO_TEST_RXD (GPIO_NUM_4) #define ECHO_TEST_RTS (UART_PIN_NO_CHANGE) #define ECHO_TEST_CTS (UART_PIN_NO_CHANGE) #define BUF_SIZE (1024) uint8_t *data = (uint8_t *) malloc(BUF_SIZE); void setup() { // put your setup code here, to run once: uart_config_t uart_config = { .baud_rate = 115200, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE }; uart_param_config(UART_NUM_1, &uart_config); uart_set_pin(UART_NUM_1, ECHO_TEST_TXD, ECHO_TEST_RXD, ECHO_TEST_RTS, ECHO_TEST_CTS); uart_driver_install(UART_NUM_1, BUF_SIZE * 2, 0, 0, NULL, 0); } void loop() { // put your main code here, to run repeatedly: int len = uart_read_bytes(UART_NUM_1, data, BUF_SIZE, 20 / portTICK_RATE_MS); // Write data back to the UART uart_write_bytes(UART_NUM_1, (const char *) data, len); }
Users browsing this forum: No registered users and 0 guests