ffainelli / cc2530prog Goto Github PK
View Code? Open in Web Editor NEWTexas Instruments CC2530 Programming tool
License: Other
Texas Instruments CC2530 Programming tool
License: Other
Hello, ffainelli.
I am trying to burn cc2530 firmware with cc2530-prog. but I have no idea what kind of firmware should be used for burning? I only have hex binary built with iar workbench.
Regards!
Hey,
First of all thank you for this piece of code, this made my work much easier.
I compiled the code on the Raspberry Pi and connected all the pins but it didn't work.
I took some time but I find out the problem, I based my research on the working cclil project and cc_flahser:
https://github.com/tobyjaffey/cctl/tree/master/ccpil
http://sourceforge.net/projects/ccflasher/
From this project you can get several things:
static void delay_ns(unsigned int ns)
{
struct timespec sleeper, dummy;
sleeper.tv_sec = 0;
sleeper.tv_nsec = ns ;
nanosleep (&sleeper, &dummy) ;
}
void delay (unsigned int millis)
{
struct timespec sleeper, dummy ;
sleeper.tv_sec = (time_t)(millis / 1000) ;
sleeper.tv_nsec = (long)(millis % 1000) * 1000000 ;
nanosleep (&sleeper, &dummy) ;
}
/*
* Hold reset low while raising clock twice
*/
static int cc2530_leave_debug(void)
{
gpio_set_value(RST_GPIO, 0);
delay(100);
gpio_set_value(RST_GPIO, 1);
return 0;
}
static int cc2530_enter_debug(void)
{
cc2530_leave_debug();
gpio_set_value(CCLK_GPIO, 0);
gpio_set_value(DATA_GPIO, 0);
gpio_set_value(RST_GPIO, 0);
delay(10);
gpio_set_value(CCLK_GPIO, 0);
delay(1);
gpio_set_value(CCLK_GPIO, 1);
delay(1);
gpio_set_value(CCLK_GPIO, 0);
delay(1);
gpio_set_value(CCLK_GPIO, 1);
delay(1);
gpio_set_value(CCLK_GPIO, 0);
delay(1);
gpio_set_value(RST_GPIO, 1);
delay(10);
debug_enabled = 1;
return 0;
}
/*
* Bit-bang a byte on the GPIO data line
*/
static inline void send_byte(unsigned char byte)
{
int i;
/* Data setup on rising clock edge */
for (i = 7; i >= 0; i--) {
//
if (byte & (1 << i))
gpio_set_value(DATA_GPIO, 1);
else
gpio_set_value(DATA_GPIO, 0);
gpio_set_value(CCLK_GPIO, 1);
delay_ns(1);
gpio_set_value(CCLK_GPIO, 0);
delay_ns(1);
}
}
/*
* Clock in a byte from the GPIO line
*/
static inline void read_byte(unsigned char *byte)
{
int i;
bool val;
*byte = 0;
/* data read on falling clock edge */
for (i = 7; i >= 0; i--) {
gpio_set_value(CCLK_GPIO, 1);
delay_ns(1);
gpio_get_value(DATA_GPIO, &val);
if (val)
*byte |= (1 << i);
gpio_set_value(CCLK_GPIO, 0);
}
After this changes I was able to get this code program the chip and verify it, but still the code doesn't appear to be running. I halted the cpu and checked the pc register and it point to zero. I suspect it has to do with the output format of the IAR compiler. which format should be used with this programmer? raw-binary? simple-code? intel-extened?
hope you can help me and many thanks for this work!!
Can it program IAR generated hex files?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.