I am using arduino pro mini (which contains Atmega328p AU) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I am wondering if I can use cc2541 itself for processing data in order to remove arduino from circuit, so that I can save power and money. I am quite new to electronics domain. Please suggest any ways to achieve it.
TL;DR version -- if you are trying to do this for just one chip and just yourself (i.e. not a product), it's probably not worth it since you'll need to spend at least $50 for a programmer.
The CC2541 is a combination of a BLE radio and 8051 with either 256K or 128K flash, and 8K of RAM. It has 23 GPIO pins, some of which can be re-purposed as I²C, SPI, UART, and programming interface
The CC2541 comes from TI with firmware supporting HCI (Host Controller Interface), which is at a lower level interface than AT commands. Some vendors, such as HMSoft, have taken the CC2541, packaged it on a board, and provided an AT command interface on top of TI's stack. That is the HM-10 on your Shield. The HM=10 can be bought separately, for example here.
Yes you can put application code on a CC2541, and use all of its I/O capabilities for your own use. It can be re-programmed using two of the GPIO pins using a TI programmer called CC Debugger, which costs $50.
The gotcha is all of TI's documentation assumes you are using the IAR Embedded Workshop for 8051, which costs almost $3000. (IAR has a free evaluation version which is good for only 30 days.) I don't know how hard it would be to use one of the free 8051 compilers out there.
I have not used the HM-10. Instead, I have used the Silicon Labs (formerly Bluegiga) BLE113, which is another small module with a CC2541 packaged inside a shielding can plus some capacitors and an antenna and costs the same as the HM-10 ($12).
The advantage of the BLE113 (besides the fact that it is shielded and FCC certified) is that instead of programming the 8051 in C, they have provided a language called BGScript, which is a BASIC like syntax -- you can literally write a BLE application in a few dozen or so lines of code.
Here is the complete BGScript code, for a BLE wireless thermometer that sends back the temperature to a host once a second:
dim tmp(5) dim celsius dim offset dim addr(6) #init gap mod, bonding and start freerunning times on system boot event system_boot(major ,minor ,patch ,build ,ll_version ,protocol_version ,hw ) #Get local BT address call system_address_get( )(addr(0:6)) # Write BT address to DI service serial number string call attributes_write(xgatt_dis_2a25,0,6,addr(0:5)) #Set device to advertisement mode and allow undirected connections call gap_set_mode(gap_general_discoverable,gap_undirected_connectable) #Allow pairing call sm_set_bondable_mode(1) #set timer to periodically create an interrupt with interval of 1s call hardware_set_soft_timer(32768,0,0) end #timer expired event hardware_soft_timer(handle) #Request for ADC reading call hardware_adc_read(14,3,0) end #ADC measurement ready event hardware_adc_result(input,value) offset=-1600 # ADC value is 12 MSB celsius = value / 16 # Calculate temperature # ADC*V_ref/ADC_max / T_coeff + offset celsius = (10*celsius*1150/2047) * 10/45 + offset #set flags tmp(0:1)=0 #set as float tmp(1:4)=float(celsius, -1) #write the temperature information to the GATT database call attributes_write(xgatt_htm_2a1c,0,5,tmp(0:5)) end event connection_disconnected(handle,result) #in case if disconnect, return to advertisement mode call gap_set_mode(gap_general_discoverable,gap_undirected_connectable) end
(There is also an XML file, gatt.xml that contains all of the GATT service and characteristic UUIDs etc.)
BGScript has access to all of the chip's peripherals, such as the GPIO pins, I²C, SPI and UART, and in the example above, the ADC. You don't have to buy an 8051 development environment because they give you one for BGScript for free. You still have to buy the $50 TI programmer though.
These days, Texas Instruments (TI) provide their Code Composer Studio (CCS) for free. It's a full-featured IDE capable of supporting a huge range of TI processors. The original poster asked a classic "open-a-can-of-worms" question which is to be commended. The reality is that a 'simple' BLE transciever is controlled by a complex System on a Chip (SoC) IC. It really is a complete computing platform on a chip with its own Real Time Operating System (RTOS) to help you get access to the features or peripherals the processor is connected to such as the RF module and any switches or sensors.
Programming an Arduino is child's play compared to programming an SoC, but then there comes a time in a developer's life when they must yet again face a mountainous learning curve in order to better themselves.