Glomation
 
Advanced Search
Welcome, Guest. Please login or register.

Login with username, password and session length
May 20, 2012, 02:56:43 AM
News: Glomation introduces new GECM-9G25 SODIMM system on module
Pages: [1]
Topic Tools  
Read November 18, 2009, 01:21:59 PM #0
gurtlerc

RS485 sample code

Hi,

Does anyone have some sample code for using the RS485 port?
 
Read November 19, 2009, 10:20:58 AM #1
slonko

Re: RS485 sample code

Hi,

Does anyone have some sample code for using the RS485 port?

Hi gurtlerc,
Do you mean the one on the J16 I/O Expansion?
I have just noticed it too and it would be useful if I can use it on my board that doesn't have any RS485 driver chip on, will do some research..
 
Read November 19, 2009, 10:49:22 AM #2
admin

Re: RS485 sample code

The RS-485 on GESBC-9260 is connected to USART3 of the AT91SAM9260 processor.  The 9260 processor has a hardware RS-485 mode.  It can be set by one of the serial port control registers.  Once it is set to RS-485 mode, the serial port can be used directly like any other Linux serial devices.

The kernel should have USART3 enabled with RTS pin included,

/arch/arm/mach-at91/board-sam9260ek.c

static void __init ek_map_io(void)

        /* USART3 on ttyS4. (Rx, Tx, RTS) */
        at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS);


The USART mode register can be set with the devmem2 utility in user space,

devmem2 0xfffd0004 w 0xc00008c1


The Linux standard serial device control can be used to set baudrate etc.

 
Read November 19, 2009, 11:14:53 AM #3
slonko

Re: RS485 sample code

The RS-485 on GESBC-9260 is connected to USART3 of the AT91SAM9260 processor.  The 9260 processor has a hardware RS-485 mode.  It can be set by one of the serial port control registers.  Once it is set to RS-485 mode, the serial port can be used directly like any other Linux serial devices.

The kernel should have USART3 enabled with RTS pin included,

/arch/arm/mach-at91/board-sam9260ek.c

static void __init ek_map_io(void)

        /* USART3 on ttyS4. (Rx, Tx, RTS) */
        at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS);


The USART mode register can be set with the devmem2 utility in user space,

devmem2 0xfffd0004 w 0xc00008c1


The Linux standard serial device control can be used to set baudrate etc.



Hi,
I do not have a RS485 driver chip, is it possible to use the lines marked "RS485" on the J16 I/O Expansion as TTL level lines to talk to a PIC?
Thanks for any info
 
Read November 19, 2009, 01:19:51 PM #4
admin

Re: RS485 sample code

The signals on J16 can be used for TTL level signals only if the RS-485 driver chip is not installed.
 
Read November 23, 2009, 08:27:36 AM #5
slonko

Re: RS485 sample code

Thanks, it works  Grin
 
Read April 25, 2011, 01:46:13 PM #6
admin

Re: RS485 sample code

The Linux kernel 2.6.37 and up now includes RS-485 mode in the serial driver for the Atmel ARM processor based systems.  The user space application should use standard ioctrl function call to set the RS-485 mode.  In fact the devmem2 method to set RS-485 mode described in previous posts no longer works for Linux kernel version 2.6.33 and up.   See http://retis.sssup.it/~scordino/code/rs485.html for more information on how to use kernel built-in RS-485 mode.
 
Pages: [1]
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re