Eike Posted January 31, 2015 Report Share Posted January 31, 2015 Hi there, I was playing around with my old papilio pro lately and I was trying to get a second hardware UART connected to the zpuino via wishbone. Well, with not much success, as you might have guessed. I wired it as shown in the picture below Oddly the SPI Modul is working perfectly fine, I checked it with a scope, but I can't figure out why the uart wont. I've tried it like Jack had shown in the old 8 uart tutorial on the Youtube-Channel from GadgetFactory but I end up not getting anything out of it. It synthesizes, loads up, the sketch compiles, but in the End nothing is happening on the physical side of things... I've tried it on different wings, with different wishbone slots and different ways to initialize the HardwareSerial, but nothing seems to work. Does anyone else had these kind of trouble with the uarts or does anyone have an idea what to do about it? Best regards, Eike Link to comment Share on other sites More sharing options...
Jack Gassett Posted February 1, 2015 Report Share Posted February 1, 2015 Hello Eike, Can you archive your project and upload it here? I think the problem is most likely because of differences between ZPUino 1 and ZPUino 2 but it will help to take a look at your project. Jack. Link to comment Share on other sites More sharing options...
Jack Gassett Posted February 1, 2015 Report Share Posted February 1, 2015 I'm trying to remember what Alvie said to do for 2.0... 2.0 libraries auto detect which wishbone slot is being used now. So try to the following variations, I can't remember which one is correct: HardwareSerial empSerial(); HardwareSerial empSerial(1); HardwareSerial empSerial(2); I guess I shouldn't have updated to ZPUino 2.0 quite yet... I was afraid this would cause a lot of confusion. Link to comment Share on other sites More sharing options...
Jack Gassett Posted February 1, 2015 Report Share Posted February 1, 2015 Ok, I just reviewed the commits and refreshed my memory from when Alvie explained to me how this works.https://github.com/GadgetFactory/DesignLab_Examples/commit/216c34eda0ec28386a30b1364d4306a429303d92 ZPUino 2.0 will find the all of the connected serial ports automatically. It's a bit confusing how it works now because at the moment you can't just specify the Wishbone slot you are connected to. You have to know that there is already a serial port connected to ZPUino. It's the default serial port, so the serial port you connected to Wishbone slot 8 is actually the second serial port that will be detected. So to access it you will do: HardwareSerial empSerial(2); This says to use the 2nd serial port detected. I also seem to remember that if you do this:HardwareSerial empSerial;It will get the next available serial port. Alvie and I have talked about ways to let you just specify the wishbone slot. I'll check in with Alvie to see how close we are to putting that in place. Jack. Link to comment Share on other sites More sharing options...
Eike Posted February 1, 2015 Author Report Share Posted February 1, 2015 Hi Jack, thanks for all the answers. I don't know why, but I got it working somehow I guess, after I tried some of your suggestions. Actually, I realized that if I use the hardware serial without giving it a slot / number (what ever it might be right now) it just uses the USB serial port. Using two HardwareSerial objects or one with different numbers didn't change anything, so I didn't come up with the idea of using three or more objects. After you said it chooses the connection automatically and not by number, I instantiated three objects just to be sure:#include <HardwareSerial.h>HardwareSerial enpSerial0(0); HardwareSerial enpSerial1(1); HardwareSerial enpSerial2(2); void setup() { enpSerial0.begin(9600); enpSerial1.begin(9600); enpSerial2.begin(9600);}void loop() { //enpSerial0.println("test"); //enpSerial1.println("test"); enpSerial2.println("test"); delay(500);}That ended up giving me some activity on my scope (yay!). I guess there are two somewhat hidden Serialport Objects in the zpuino (the one to the PC and some other...), so that my newly added one got the third ID. Just one thing I wanted to ask (somewhat off topic): Did anyone try to get the DesignLab / Arduino compiler working with eclipse? I can live with the standard arduino ide, but sometimes I miss all the nice features like auto completion and suggestion, especially since I am used to work with eclipse / visual studio 2010... But anyway, thank you for the help and for being there for the community. You don't see that much these days I love the papilio project, keep up the good work! Link to comment Share on other sites More sharing options...
alvieboy Posted February 1, 2015 Report Share Posted February 1, 2015 Jack, I just pushed a preliminary approach to the slot issue. Basically, it allows you to do this:HardwareSerial mySerial( WishboneSlot(6) );// ...mySerial.begin(baudrate)I updated HardwareSerial and the SPI library. I can add support for all other devices, if needed. Alvie Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.