Quantcast
Channel: Wireless Connectivity
Viewing all articles
Browse latest Browse all 116964

Forum Post: RE: CC2540 -- UART -- Arduino 2560 -- PC

$
0
0

Under i provide my changes under so people can easy get TX working. :) 

Note. This has only been done with simpleBLEPeripheral project and added serialapp project (serialappUtil.c & h file + hal_uart_dma.c) into simpleBLEPeripheral.

In my case i used a level coneverter between the dongle and the RS232 connector. I will also test to check if it works with Arduino if someone would want to know. :) 

The setup under is provided with: 

- Baudrate = 9600.

- 1 stop bit.

- No flowcontrol.

- Tx output pin on debug connectors is P0_3.  (Also remember to have same GND as level converter)

I added this line in my main: 

************************************************

/* UART CONFIG*/
serialAppInitTransport();

*************************************************

Added in serialAppUtil.C (beneith HalUARTOpen() ) 

*************************************************

HalUARTWrite(SBP_UART_PORT, " this works", 11);

*************************************************

In hal_board_cfg.h i edited this function;

***********************************************

#ifndef HAL_UART
#if (defined ZAPP_P1) || (defined ZAPP_P2) || (defined ZTOOL_P1) || (defined ZTOOL_P2)
#define HAL_UART TRUE
#else
#define HAL_UART FALSE
#endif
#endif

**********************************************

To this here:

*********************************************

/* Set to TRUE enable UART usage, FALSE disable it */
#ifndef HAL_UART
#define HAL_UART TRUE
#endif

*********************************************

Finally i edited this in simpleBlePeropheral.c

*************************************************

HalLedSet(HAL_LED_1, HAL_LED_MODE_ON );

// For keyfob board set GPIO pins into a power-optimized state
// Note that there is still some leakage current from the buzzer,
// accelerometer, LEDs, and buttons on the PCB.

P0SEL = 0x08; // Configure Port 0 as GPIO, expept for P0.4
P1SEL = 0; // Configure Port 1 as GPIO
P2SEL = 0; // Configure Port 2 as GPIO

P0DIR = 0xF4; // Port 0 pins P0.0 P0.1 (buttons) and P0.3 as input(RX),
// all others (P0.2-P0.7) as output
P1DIR = 0xFF; // All port 1 pins (P1.0-P1.7) as output
P2DIR = 0x1F; // All port 1 pins (P2.0-P2.4) as output

P0 = 0x03; // All pins on port 0 to low except for P0.0 and P0.1 (buttons)
HalLedSet(HAL_LED_1, HAL_LED_MODE_OFF);
//YELLOW LIGHT OFF!
HalLedSet(HAL_LED_2, HAL_LED_MODE_ON);
//RED LIGHT ON!

****************************************************

Sincear, Michael. 


Viewing all articles
Browse latest Browse all 116964

Trending Articles