XMC1100: Read Serial

Hi,

I have a TLE493DA2B6 set up as an XMC2Go for Arduino (GitHub - Infineon/XMC-for-Arduino: Integration of Infineon's XMC microcontrollers into the Ard).

The wiki page (XMC 2Go · Infineon/XMC-for-Arduino Wiki · GitHub) helped me get the thing running just fine, and I'm able to upload my own sketches and send/receive via Serial monitor.

However, I was hoping to get serial data from another Arduino (an ATmega2560) as well, preferably by just connecting to one of the header pins. This is where I ran into a bit of an issue, since it seems the serial pins used by the USB driver aren't mirrored for the breakout.

I wanted to try getting this communication working in Serial or with whatever else would prove easiest, but this is where the wiki seemed to be lacking in detail a bit. The irony here is that the breakout supports many communication protocols but the Arduino library doesn't explain how they are accessed in Arduino code.

I tried using SoftwareSerial to set the Rx pin as one of my GPIO pins, but it seemed this XMC didn't have full support for that library. Basically a dead end.

So does anyone here have suggestions to get data from this other Arduino as painlessly as possible? Doing some custom messaging with digitalWrite/Read is a possibility, but if I could use an existing protocol it would be preferable.

Define what exact purpose you have for this connection. Your core supports I2C and SPI, the biggest problem is probably the voltage. According to the documentation I found for your system it runs on 3V3 and the datasheet explicitly says that any pins must not have a voltage higher than Vcc+0.5V.

The XMC core doesn't support SoftwareSerial.

This is where I ran into a bit of an issue, since it seems the serial pins used by the USB driver aren't mirrored for the breakout.

I don't know what you mean but the board described on the linked page has the UART on pins 6/7.

The purpose is to receive some data from another sensor, so it's Rx only.

Good catch on the voltage, I'll try using a divider to step down the Arduino Mega's Tx pin voltage and see if the UART pins work then.

But...

pylon:
I don't know what you mean but the board described on the linked page has the UART on pins 6/7.

There is a note below the wiki pinout image that states "On-board UART TX6 / RX7 [don't share] the same channel as the debug UART via the USB connection"

Heeding this note, I wasn't sure what UART Serial.read() would listen to (and by successfully using 'Send' in Serial Monitor, it seemed to be the USB connection's UART), or how to change this UART to the pin 6/7 one. Is there a way to configure this when I initialize Serial?

There is a note below the wiki pinout image that states "On-board UART TX6 / RX7 [don't share] the same channel as the debug UART via the USB connection"

Heeding this note, I wasn't sure what UART Serial.read() would listen to (and by successfully using 'Send' in Serial Monitor, it seemed to be the USB connection's UART), or how to change this UART to the pin 6/7 one. Is there a way to configure this when I initialize Serial?

You didn't tell that you were using the USB serial channel too. Remember we have just the information you wrote here in your posts. If you don't tell us all the things that may be implicitly in your project we simply assume we can choose the option that looks best for us.

The purpose is to receive some data from another sensor, so it's Rx only.

Which way?
For reading a sensor I2C is probably the easiest interface to use here. You may even get away without a level converter if you use short wires between the two boards. But be sure that the pull-ups go to 3.3V and not 5V!

Actually, I'm not really using the USB Serial for anything save for upload, it is just configured as this Arduino package's 'Serial' by default. I'd actually rather use pins 6/7 if there's some way to change to that.

Or perhaps it's possible to get the serial data out from my Arduino Mega into this board's USB Serial pins? Perhaps hook the serial ports together? I've never tried that, but I suppose it might work.

Arduino Mega Tx => XMC Rx.

I'll try I2C out failing a way to configure XMC pins 6/7 for serial, since that would be the path of second least resistance.

I'll be able to share my findings on Monday.

Thanks.

I discovered a bit more about the XMC's limitations as an Arduino-esque environment. One thing I noticed quickly is that SPI didn't seem to be implemented in this - possibly another dead end. I didn't try I2C, but I had a low estimate of its chances for success following that realization.

I did eventually solve the issue with the two different UARTs (one on pin 6/7 and one for the USB converter) and not being able to receive data on 6/7 by default. When the 'XMC as Arduino' module is chosen, an option to use the 'On-Board' (6/7) or 'PC' serial port becomes available under the 'Tools' tab. Selecting one or the other then uploading seems to enable it as the definitive 'Serial', thereby disabling the other.

This setup means I could either see Tx from the device on my Serial Monitor and give it Rx's from Serial Monitor's send window, OR I could Rx/Tx on pins 6/7 but with no clear way to get that data my computer. I couldn't see USB Tx's from the device while also having the device Rx from my other Arduino.

This is, in my opinion, an agonizingly bad means of implementation, but my use case is probably possible with some circumvention of the 'XMC as Arduino' framework in standard C.

My current solution is to set the Serial source for the XMC as 'On-Board' and use the onboard UART Rx to get data from my other sensor. Then both the sensors' data is transmitted with the onboard UART Tx to yet another Arduino, which actually is just a passthrough that receives the data on Rx and sends it out on Tx, which is also linked to Serial Monitor.

It's obviously not an ideal solution, but I probably won't bother with changing the configuration as it currently works for my purposes. Hopefully my difficulties here can help others down the road, however.

I discovered a bit more about the XMC's limitations as an Arduino-esque environment. One thing I noticed quickly is that SPI didn't seem to be implemented in this - possibly another dead end. I didn't try I2C, but I had a low estimate of its chances for success following that realization.

The code has SPI support. How do you get to the conclusion that it's not supported? Did you try it?