Eike

Adding Wishbone Uart Modul

Recommended Posts

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

post-38452-0-46893100-1422726659_thumb.p

 

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... 

 

post-38452-0-09198700-1422727177_thumb.p

 

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 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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! 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now