Page 2 of 2

Re: Write to USART1 UEXT on SAM7X256

Posted: Mon Jul 23, 2012 11:06 am
by mabl
Timoses wrote:Hey there again.

Alright, I now tried to connect the MOD-USB-RS232 to the PC.
I tried it with a USBAM-USBAM which kinda looks like this one: http://www.alibaba.com/product-gs/56990 ... e_for.html

Unfortunately, no new COM-Port is detected. I tried plugging the MC in and out, executing the program ...

Any suggestions? Am I using the wrong adapter?

Just wondering: Why do you need an adapter? The Mod-USB-rs232 can be directly connected to a PC with a standard USB cable, can't it? If you are using windows, you might also need to install a driver.

Re: Write to USART1 UEXT on SAM7X256

Posted: Mon Jul 23, 2012 11:43 am
by Timoses
For me the writeUSART() function is in the ChibiOS/hal/platforms/AT91SAM7/serial_lld.c ..

I guess there's been stuff modified already.. So maybe this is an added function.
But that function works with the RS232 Connector. It directly controls the USART registers TPR (Transmit Pointer Register), TCR (Transmit Counter Register) and PTCR (PDC (peripheral dma controller) Transfer Control Register).
Example: "pUSART0->US_PTCR = AT91C_PDC_TXTEN;"
pUSART0 is defined in the usart_init...() function, which I guess is also custom, as AT91C_BASE_US0; (pUSART0 = AT91C_BASE_US0;).
- usart_init()
is called from
- void sd_lld_start(SerialDriver *sdp)
which itself is called by
- sdStart(&SD2, &default_config);
in the main.c

I also tried to copy usart_init() to make a usart1_init() and use the pUSART0 = AT91C_BASE_US1; address instead of the US0.

But, I can't test anything of that if the connection from the MOD-USB-RS232 to the computer doesn't work.
Plugging in the MOD-USB-RS232 alone with the USBAM-USBAM to the computer should give me a new COMM Port in the device manager of the computer, right?
Or do I need to install a driver on the computer??

My supervisor suggested to build myself a cable to connect the UEXT directly to USB... Which doesn't make much sense right?...... Anyway, that's what the MOD-USB-RS232 is there for.... So why should I build it myself.. >.<

Thanks for the helpful replies already, and the interest in helping : P !



Edit:

Ohp, didn't see your reply there @ mabl.

Well, the output of the MOD-USB-RS232 is Mini-USB, so there's this mini-usb to usb (http://www.amazon.co.uk/StarTech-com-Mi ... B002O1S8IE) and from there the USBAM-USBAM for the connection to the computer.

What kind of driver would I need? (I am using windows (XP)) On https://www.olimex.com/dev/mod-usb-rs232.html there's just a firmware which I suppose is for the MOD-USB-RS232 itself...?

Re: Write to USART1 UEXT on SAM7X256

Posted: Mon Jul 23, 2012 12:39 pm
by Giovanni
There is no writeUSART() anywhere, apparently you are using modified stuff.

Assuming you are using an unmodified ChibiOS start from an existing demo, you don't need to modify anything, just initialize the driver SD2 this way:

sdStart(&SD2, NULL);

It will initialize the port as 38400-8-N-1, then you can write using sdPut() or sdWrite().

Giovanni

Re: Write to USART1 UEXT on SAM7X256

Posted: Thu Jul 26, 2012 2:45 pm
by Timoses
@ mabl
Ohp, didn't see your reply there @ mabl.

Well, the output of the MOD-USB-RS232 is Mini-USB, so there's this mini-usb to usb (http://www.amazon.co.uk/StarTech-com-Mi ... B002O1S8IE) and from there the USBAM-USBAM for the connection to the computer.

What kind of driver would I need? (I am using windows (XP)) On https://www.olimex.com/dev/mod-usb-rs232.html there's just a firmware which I suppose is for the MOD-USB-RS232 itself...?



38400-8-N-1 is like... Baudrate-Char_len- ... ?

Re: Write to USART1 UEXT on SAM7X256

Posted: Thu Jul 26, 2012 3:29 pm
by Giovanni
Timoses wrote:38400-8-N-1 is like... Baudrate-Char_len- ... ?


38400 baud, 8bits, No Parity, 1 stop bit

Giovanni

Re: Write to USART1 UEXT on SAM7X256

Posted: Thu Aug 02, 2012 11:22 am
by Timoses
Cool, thanks @ Giovanni

Using an oscillator I now could confirm that data is being sent over the UEXT connector.
Plus, using a normal USB cable from the MOD-USB-RS232, the computer now recognizes it as "cdc rs-232 emulation demo"..
Now I'm trying to find a usb cdc driver... No luck so far :<

Does anybody know where to get such a driver from?

Edit:
Found one :>.
Unfortunately just a "demo" .. but still, it works.
http://www.thesycon.de/eng/usb_cdcacm.shtml

Re: Write to USART1 UEXT on SAM7X256

Posted: Thu Aug 02, 2012 11:44 am
by mabl
I think Windows needs some INI File for each Serial Driver, doesn't it? I somewhere read that windows 8 even needs signed INIs, so you cannot even make CRC Serial Driver work there :mrgreen:

Timoses: Linux will recognize it out of the box. You might also try out the original Microchip Demo http://ww1.microchip.com/downloads/en/A ... lation.EXE or just ask Olimex, since they sell it :ugeek:

EDIT: Found the article http://blog.makezine.com/2012/06/06/soa ... -friendly/