Hi
Did anyone make, and share, some code (I code in C using Arduino IDE and/or PlatformIO/VSCode) for a rotary dial on the core2 touch-screen?
Or a slider?
Hi
Did anyone make, and share, some code (I code in C using Arduino IDE and/or PlatformIO/VSCode) for a rotary dial on the core2 touch-screen?
Or a slider?
Hi
How do I setup PlatformIO in VSCode so I can write apps for the M5Stack Core 2, i.e. get the libraries into VSCode/PlatformIO? I seem to only be able to install them specifically for a single project.
Can I get the examples easily into VSCode/PlatformIO, like in the Arduino IDE?
Thanks
Yes, but since none of these function calls reside in my code, but (I assume) in libraries, I would have expected this to be handled by using M5Core2.h and choosing the correct target in the IDE.
I can't see what else to change, other than replacing some libraries, but what to replace, and with what, in that case.
Hi
I have some code that compiles and runs fine for Core
So I replaced M5Stack.h with M5core.h and compiled it for the Core2 and downloaded.
But it just keeps rebooting.
Here's what I get in the serial window. Any suggestions on what is wrong and needs to be adapted to make Core-code work in a Core2?
Rebooting...
M5Core2 initializing...axp: vbus limit off
axp: gpio1 init
axp: gpio2 init
axp: rtc battery charging enabled
axp: esp32 power voltage was set to 3.35v
axp: lcd backlight voltage was set to 2.80v
axp: lcd logic and sdcard voltage preset to 3.3v
axp: vibrator voltage preset to 2v
E (1455) ledc: ledc_channel_config(369): gpio_num argument is invalid
touch: FT6336 ready (fw id 0x10 rel 1, lib 0x300E)
OK
E (3029) rmt: rmt_set_gpio(526): RMT GPIO ERROR
E (3029) rmt: rmt_config(686): set gpio for RMT driver failed
[i] SDK: 'v4.4-beta1-189-ga79dc75f0a'
[i] CPU Speed: 240 MHz
[i] Chip Id: 43F23A08
[i] Flash Mode: 00000002
[i] Flash Size: 01000000
[i] Flash Speed: 80 MHz
[i] Heap 261868/288324
[i] SPIRam 4192139/4192139
[i] Starting
[WiFi] Connecting...
OTA Ready
[i] read status from SPIFFS
[i] Setup MQTT
[REL] setting 0 to OFF
[REL] setting 1 to OFF
[REL] setting 0 to ON
[REL] setting 1 to ON
[REL] setting 0 to OFF in 2000 ms
[REL] setting 1 to OFF in 5000 ms
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400df248 PS : 0x00060733 A0 : 0x800dfae4 A1 : 0x3ffb2710
A2 : 0xffffffff A3 : 0x00000003 A4 : 0x00060720 A5 : 0x00000000
A6 : 0x007b764c A7 : 0x003fffff A8 : 0x3f410ab4 A9 : 0x00000058
A10 : 0xffffffab A11 : 0x00000084 A12 : 0x3ffc9ebc A13 : 0x00060723
A14 : 0x00060720 A15 : 0x00000001 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000058 LBEG : 0x40086565 LEND : 0x4008656d LCOUNT : 0x00000027
Backtrace:0x400df245:0x3ffb27100x400dfae1:0x3ffb2740 0x400dff3f:0x3ffb2770 0x400d4031:0x3ffb27b0 0x400d4170:0x3ffb27e0 0x400d5bc3:0x3ffb2800 0x400ea60d:0x3ffb2820
ELF file SHA256: 0000000000000000
Rebooting...
Hi
I am trying to use GPIO16 as input on an M5Stack Core, but it does not work.
I tried using GPIO35 instead and that worked fine.
But I want this signal on GPIO16. Any ideas on how to make that work?
When searching for info on this I have not found any info that it shouldn't work. In general it says that it should work to use GPIO16 both as output and input.
I am using GPIO17 as output and that is working fine.
I thought I had LoRaWan868 but it seems I have LoRaWan (as they are black)
The blue ones I think are called just LoRa868, this one-
https://shop.m5stack.com/products/lora-module-868mhz?variant=31093175910490
I see there is also a module called LoRaWan868 but that has a different formfactor, not stackable.
It said clearly in the spec sheet for the module I have, I have double checked, that it should work with P2P.
THe module I linked in the OP is the one I have. It is named I think LoRaWAN, and it supports the 868 MHz band.
Thanks!
For some reason I had to remove the M5Stack library entirely from the libs-folder, then it worked. Annoying.
Finally I got the code to compile and download to the M5 without hanging it.
But transmission does not work, and after some debugging I found out that anything that is sent to the LoRa-module, is responded with "+ERROR: Command does not exist".
So at least the LoRa module is alive and communication with it is working. But the LoRa-library attached to this example seems not to match the M5 LoRaWAN module.
Thanks!
I am trying to compile these, and they compile fine for Core, but I have a Core2, and then they don't compile, not even when M5Core2.h is included, with or without M5Stack.h
Any advice on how to get them to compile for Core2?
Hi
How can I change this code so it compiles for M5Stack-Core2 AWS instead of M5Stack-Core?
I tried replacing the M5Stack.h include with M5Core2.h but it didn't help. I also tried adding the latter to the first, but it also didn't help.
Thanks!
/*
device_B.ino
*/
#include <M5Stack.h>
#include <LoRaWan.h>
#define SerialUSB Serial
unsigned char buffer[128] = {
0,
};
uint8_t flag_test_868 = 0;
void key_scan(void *arg)
{
while (1)
{
onReceive();
// lora.loraDebug();
}
vTaskDelete(NULL);
}
void setup(void)
{
M5.begin(true,true,true,false);
SerialUSB.begin(9600);
lora.init();
delay(2000); // must delay for lorawan power on
lora.initP2PMode(868, SF12, BW500, 8, 8, 20);
M5.Lcd.setTextFont(2);
M5.Lcd.println("Device B");
M5.Lcd.setTextColor(BLUE);
int core = xPortGetCoreID();
// M5.Lcd.println(core);
xTaskCreatePinnedToCore(key_scan, "key_scan", 2048, NULL, 0, NULL, 0);
}
void loop(void)
{
// lora.loraDebug();
if (M5.BtnA.wasPressed())
{
M5.Lcd.setCursor(0, 20);
M5.Lcd.fillRect(0, 20, 320, 215, BLACK);
}
if (M5.BtnB.wasPressed()) //send data (433MHz)
{
flag_test_868 = 0;
M5.Lcd.setTextColor(BLUE);
init_433();
send_data();
delay(300);
Serial2.print("AT+TEST=RXLRPKT\r\n");
M5.Lcd.println("433M Init and Send \"Hello World\"...");
}
if (M5.BtnC.wasPressed()) //send data (868MHz)
{
flag_test_868 = 1;
M5.Lcd.setTextColor(YELLOW);
init_868();
send_data();
delay(300);
Serial2.print("AT+TEST=RXLRPKT\r\n");
M5.Lcd.println("868M Init and Send \"Hello World\"...");
}
M5.update();
}
void init_433()
{
lora.initP2PMode(433, SF12, BW500, 8, 8, 20);
}
void init_868()
{
lora.initP2PMode(868, SF12, BW500, 8, 8, 20);
}
void send_data()
{
lora.transferPacketP2PMode("hello world");
}
void onReceive()
{
short length = 0;
short rssi = 0;
memset(buffer, 0, 128);
length = lora.receivePacketP2PMode(buffer, 128, &rssi, 1);
if (length)
{
SerialUSB.print("Length is: ");
SerialUSB.println(length);
SerialUSB.print("RSSI is: ");
SerialUSB.println(rssi);
SerialUSB.print("Data is: ");
if (flag_test_868)
{
M5.Lcd.print("868M Recv: ");
}
else
{
M5.Lcd.print("433M Recv: ");
}
for (unsigned char i = 0; i < length; i++)
{
SerialUSB.print((char)buffer[i]);
M5.Lcd.print((char)buffer[i]);
// SerialUSB.print("0x");
// SerialUSB.print(buffer[i], HEX);
// SerialUSB.print(" ");
}
SerialUSB.println();
M5.Lcd.println();
}
}
Here's a couple of the first errors that occurs
In file included from C:\Users\Thomas Nilsson\Documents\Arduino\libraries\M5Core2\src/M5Core2.h:78,
from C:\Users\Thomas Nilsson\Documents\Arduino\M5-ProductExampleCodes\Module\LORAWAN\Arduino\lorawan_receiver\lorawan_receiver.ino:6:
C:\Users\Thomas Nilsson\Documents\Arduino\libraries\M5Core2\src/utility/M5Button.h:804:7: error: redefinition of 'class Button'
class Button : public Zone {
^~~~~~
In file included from C:\Users\Thomas Nilsson\Documents\Arduino\libraries\M5Stack\src/M5Stack.h:110,
from C:\Users\Thomas Nilsson\Documents\Arduino\M5-ProductExampleCodes\Module\LORAWAN\Arduino\lorawan_receiver\lorawan_receiver.ino:5:
C:\Users\Thomas Nilsson\Documents\Arduino\libraries\M5Stack\src/utility/Button.h:18:7: note: previous definition of 'class Button'
class Button {
^~~~~~