-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Use UART with CH32V003F4P6 in Arduino IDE? #163
Comments
You can just use it, same as regular Arduino, but make sure to use the latest code of the master branch, since the released version lacks many improvements. Also look into the PR's to find more improvments. I submitted PR #145 to add interrupt driven serial for better communication and support of Serial.available() and Serial.peek().
Yes. Use the released core, then update with improvements (see above). |
Thank you for your help. UART is working fine. Now, I'm trying to use the I2C protocol on a CH32V003F4P6 microcontroller with the Arduino IDE. I'm testing it with the following I2C scanner code:
void loop() {} Issue: Setup: Microcontroller: CH32V003F4P6 Tested Devices: [e.g., I2C L3G4200D, I2C 0.91 display] Steps Taken: Questions: Is there any additional configuration required in the CH32V003 Arduino core for I2C to work properly? |
I2C should work. Most limitations were fixed by my PR #108 (which has been merged). My first guess is that you probably need some better pull-ups on the I2C lines. If I remember well, this core doesn't set the internal pull-ups (or perhaps they are insufficient). So in contrast to using I2C on for instance an Arduino Uno you need to add external pull-ups. I've had fine results using 10K resistors between SDA/SCL and VCC. What values are you using? What level is your VCC? When developing the I2C PR I've tested with a various devices, such as DS3231 and 24C04. Edit: sometimes adding a capacitor can help to fix power issues. Some I2C devices only work well on 5V. Perhaps recheck your wiring, just to be sure. (On occasion I've lost some time only to find out that I reversed connections) |
VCC is 3.3V and I have tried with 4.7K resistor and 10K resistor. Device is still not detecting(L3G4200D is working with other controllers). |
Perhaps you have other I2C devices to test? My test was with default I2C speed (100K). |
Can I use GSM with CH32V003F4P6 ? |
That question is so broad that I can answer yes, sure. Some good duct tape will fix almost anything to your GSM... ;-) Seriously though: perhaps narrow your question? Is this still related to using UART? Perhaps something for a new issue? |
yes, it's related to using UART. |
Then yes; just send the right commands to do whatever you want and keep your code small enough to fit it all in the V003. Good luck with your project! |
Thank you @maxint-rd for your help, I was interfacing with GSM and CH32V003F4P6 and it's working fine for calling and doing SMS. Here is the code: `#include <GSMSimCall.h> // Use HardwareSerial (USART1) on CH32V003 static volatile int num = 0; // Initialize GSMSimCall with Hardware Serial (USART1) void setup() { call.init(); Serial.print("Set Phone Function... "); // Check network registration Serial.println(gprs.getIP()); Serial.println(gsm.sendATCommand("AT+CFUN=1")); // Set full phone functionality // Try forcing network registration // Check signal quality // Check operator name Serial.print(gsm.sendATCommand("AT+CREG?")); // Check again Serial.print(gsm.sendATCommand("AT+CGPSINFO=?")); delay(1000); // Check signal quality delay(1000); // Get operator name from SIM card // Initialize call function delay(1000); // Make a call void loop() {
} I hope this will helpful. If anybody has any suggestions then please let me know. |
Excellent! Thanks for the feedback. I saw the GSM code you posted initially. Seems like a good example that other people might find useful too. Perhaps you want to leave a link here to that example somewhere on GitHub? |
Hello everyone,
I am new to the CH32V003F4P6 microcontroller and am trying to get started with it using the Arduino IDE. Specifically, I want to use the UART functionality to send and receive data over serial communication.
I have the following questions:
Any help or examples would be greatly appreciated!
Thank you in advance!
The text was updated successfully, but these errors were encountered: