@felmue thank you for making me aware of that thread! The information contained within worked like a charm!
Posts made by Abraxas
-
RE: M5 AtomS3 Lite And Arduino Serial Monitor
-
M5 AtomS3 Lite And Arduino Serial Monitor
So, I'm not sure what is going on or if I'm doing something wrong here, but I'm looking to troubleshoot an M5 AtomS3 Lite (via USB) using the Arduino's built in serial monitor on my Mac.
I have some simple code shown below to test the serial monitor output but no data is being displayed despite a successful upload and run by the M5 AtomS3 Lite. Any help or suggestions here would be great.
#include "M5AtomS3.h" void setup() { AtomS3.begin(true); AtomS3.dis.setBrightness(100); AtomS3.dis.drawpix(0x0000ff); AtomS3.update(); Serial.println("Click BtnA to Test"); } void loop() { AtomS3.update(); if (AtomS3.BtnA.wasPressed()) { AtomS3.dis.drawpix(0xff0000); AtomS3.update(); Serial.println("Pressed"); } if (AtomS3.BtnA.wasReleased()) { AtomS3.dis.drawpix(0x00ff00); AtomS3.update(); Serial.println("Released"); } }
-
RE: M5Dial's External Port A I2C Capability or Lack Thereof
@teastain Thanks Teastain! I was looking into some esp-now examples but it was a bit of a struggle trying to figure out what is supposed to work. (A lot of examples and a lot of wrong ways to implement esp-now). Your code gave me the jump I needed. I was able to adapt your code to read Rfid tags and get cross talk happening! Thanks again!
-
RE: M5Dial's External Port A I2C Capability or Lack Thereof
@teastain said in M5Dial's External Port A I2C Capability or Lack Thereof:
ESP_NOW
No, mostly because I did not know this protocol existed. This looks like it could be a promising avenue. Thanks for the suggestion Teastain!
-
RE: M5Dial's External Port A I2C Capability or Lack Thereof
@felmue said in M5Dial's External Port A I2C Capability or Lack Thereof:
here
Your assumption is correct. From my understanding of I2C, it seems like an I2C bus should be able to support multiple masters on the same bus. And it should be possible to have a master receive information as long as it is not busy sending information.
With that said, it was busy with the RFID peripheral so maybe that's the problem or I could be entirely mistaken all together on how I2C works. You've given me some documents to digest as well. So I'll get back to you with a new configuration hopefully soon. Thanks!
-
RE: M5Dial's External Port A I2C Capability or Lack Thereof
@felmue Yes, I did hit an issue. I looked at your code but it seems to be looking at what's on the bus but the bus is not experiencing any real data traffic because the peripherals are not being used. I'm not really sure that it can be used as a true test of both internal and external bus capabilities.
Below is some code I modified using M5stack's RFID example and added I2C communication.// Libraries to include #include "M5Dial.h" // Set up and initialize constants and variables const byte MY_ADDRESS = 0x12; const byte SLAVE_ADDRESS = 0x13; String uid = ""; String oldUid = ""; void setup() { // Initialize dial rfid and screen auto cfg = M5.config(); M5Dial.begin(cfg, false, true); M5Dial.Display.setTextColor(GREEN); M5Dial.Display.setTextDatum(middle_center); M5Dial.Display.setTextFont(&fonts::Orbitron_Light_32); M5Dial.Display.setTextSize(1); M5Dial.Display.drawString("RFID Card", M5Dial.Display.width() / 2, M5Dial.Display.height() / 2); // Set up I2C address and recieve transmission event handling Wire.begin (MY_ADDRESS); Wire.onReceive (receiveEvent); } void loop() { // Find out if a card is available for reading if(M5Dial.Rfid.PICC_IsNewCardPresent() && M5Dial.Rfid.PICC_ReadCardSerial()) { uint8_t piccType = M5Dial.Rfid.PICC_GetType(M5Dial.Rfid.uid.sak); // Check to see if PICC is Classic MIFARE type if(piccType != MFRC522::PICC_TYPE_MIFARE_MINI && piccType != MFRC522::PICC_TYPE_MIFARE_1K && piccType != MFRC522::PICC_TYPE_MIFARE_4K) { M5Dial.Display.clear(); M5Dial.Display.drawString("no support", M5Dial.Display.width() / 2, M5Dial.Display.height() / 2); return; // bad card - loop done } // else get UID data uid = ""; for(byte i = 0; i < M5Dial.Rfid.uid.size; i++) { uid += String(M5Dial.Rfid.uid.uidByte[i], HEX); } // And output stored UID data to the screen if its a different card from the card scanned previously. if(uid != oldUid) { M5Dial.Display.clear(); M5Dial.Speaker.tone(8000, 20); M5Dial.Display.drawString(M5Dial.Rfid.PICC_GetTypeName(piccType), M5Dial.Display.width() / 2, M5Dial.Display.height() / 2 - 30); M5Dial.Display.drawString("card id:", M5Dial.Display.width() / 2, M5Dial.Display.height() / 2); M5Dial.Display.drawString(uid, M5Dial.Display.width() / 2, M5Dial.Display.height() / 2 + 30); oldUid = uid; // Also send uid data to microcontroller Wire.beginTransmission(SLAVE_ADDRESS); Wire.write(uid.c_str()); Wire.endTransmission(); } } } // recieve and display UID data from another M5Dial void receiveEvent(int tSize) { uid = ""; for(int i = 0; i < tSize; i++) { uid += Wire.read(); } M5Dial.Display.clear(); M5Dial.Speaker.tone(8000, 20); M5Dial.Display.drawString("card id:", M5Dial.Display.width() / 2, M5Dial.Display.height() / 2); M5Dial.Display.drawString(uid, M5Dial.Display.width() / 2, M5Dial.Display.height() / 2 + 30); oldUid = uid; }
The code above can be copied over to another M5Dial and the addressing is just swapped. Theoretically it should work but when one dial receives RFID card data the other does not display this information. I think that it is transmitting this information but on the interior bus not the external bus. To fix this I added a line to my setup code to include the external I2C bus shown below:
Wire.begin (13, 15);
However that seemed to kill RFID functionality. And this is where I currently sit, hence the questions and comments above hoping for some help.
-
RE: M5Dial's External Port A I2C Capability or Lack Thereof
@robski Not a bad idea but UART is located on pins G43 and G44 which are not broken out (Port B is G1 and G2). I might be able to use the USB C port but that's just a hassle and a half as far as prototyping, debugging, and expansion is concerned.
-
M5Dial's External Port A I2C Capability or Lack Thereof
I was pretty excited to see an external I2C port (G13 - SDA & G15 - SCL) on the M5dial since it seems to act more like a self-contained smart sensor than a microcontroller. I figured this I2C port could potentially allow it to communicate with another micro-controller/computer allowing it to relay quite a bit of information along. However, I'm not really seeing a way to initialize and use this port for this purpose. Am I missing something here? I know the dial has an internal I2C port (G11 - SDA & G12 - SCL) being used to read RFID, touch screen, and RTC functions. Does this interfere with having a second I2C bus open?
-
RE: Error Reading from an SD card
@M5Stack After looking at your comment again I figured out what you were trying to tell me (Took me a while to figure it out). I forgot to tell the M5Stack where to look for the text file using /sd/file_name. That took care of the error. Still am unable to print what I want to the screen but at least I'm one step closer.
-
RE: Error Reading from an SD card
Hi M5Stack,
Thanks for your answer but this really doesn't help me. I'm trying to create a database so that I can cherry pick the information I want to show the user based on their inputs. The code you sent me takes all data and throws it up on the screen regardless of whether the user asked for that information or not. Here is a small example using python:SD card file data:
Python code:
Python output:
The M5stack does have the ability to parse out information from a list of list, I know because I tested it, but I'm having trouble reading the file from an SD card and creating a list of lists (basically an in memory ready data base.) The reason for the SD card is because this information changes depending on the project. Changing information on an SD card (or switch SD cards) is a lot easier than programming information straight to the M5stack.
Also based on your answer where is fs.close()? Does the M5stack automatically do this or is the file left open while the program is running. If the file is left open while the program is running, how do you mitigate file corruption when loss of power to the M5Stack occurs?
-
Error Reading from an SD card
Hi there!
I'm trying to read file information from an SD card and store that information for later retreival but I keep getting an error on line 10 that I do not understand. Does Anyone know what is going on or what I am missing? I am using an M5stack Fire core with 1.8.0-fire firmware. Code and Output error can be seen below.
-
USB Module (MAX3421E) Python/UI Flow Example?
I would like to take advantage of M5Stack's USB Module (MAX3421E) using python / UI Flow. However when checking for documentation on M5's documentation page, The M5Stack community, and the internet in general I am unable to find anything useful. Does anyone know how I can get this module working using python / UI Flow?
-
RE: Stepper motor module clarification needed
I look forward to hearing about your hacking ideas. Best of luck :)
-
RE: Stepper motor module clarification needed
Good to know thanks! I don't know how feasible it would be yet because I haven't looked at the physical board but how about running jumper wires from M1's pads to the physical pins of the other motor drivers (I just need one more stepper motor for a total of two with the same micro-stepping resolution). Technically that should work and I don't see a problem with it electrically speaking. Thermally speaking however might be a another concern.
-
RE: Stepper motor module clarification needed
Thank you for the clarification! Just a couple follow up questions:
- If M1 has solder pads for adjusting step size what about M2 and M3?
- When you say mega does that mean the Arduino Mega? if so, how does the mega fit into re-flashing the stepper module? Is there a tutorial on how to use the mega to do this?
-
Stepper motor module clarification needed
I just have a few questions concerning the stepper motor module. The questions are as follows:
- What is the step mode for each stepper driver? If the schematic is to be believed from the documents site (and assuming the M5 module really does have DVR8825 stepper drivers and not A4988 drivers) M1 is a 1/32 step while m2 and m3 float which means I don’t know what they are set to.
- Is the current limit already set on each stepper driver or is that something I need to adjust?
- It looks like the Atmel chip on the stepper module is running GRBL 0.8. Am I able to flash GRBL 1.1 on the Atmel chip without breaking anything? (The reason I ask is because it looks like I2C is used to send commands instead of using the USB to serial link normally used by a computer to Arduino device.) And if so, how do I do that?
- How do I adjust any preprogrammed GRBL settings as needed?