Pages:
Author

Topic: Antminer D3 Blissz firmware (10/12 v1.12 update) - page 90. (Read 125911 times)

newbie
Activity: 62
Merit: 0
Heya so i started using your firmware to OC mine D3 so far iv been able to get stable 21gh with few hw on 1 chain , fan on 90% but im not sure about the chip temperature for 24/7 usage  my hottest chain has chip  74 +-  would this be alrigh for nonstop   mining ?

Of course the chances of breaking something increases when OCing, but I think your temperatures are fine, so it should not be an issue. The hashrate of 21Gh.s us really nice if you don't mind the noise and electricity Smiley Let us know how it goes.

OK so this is my final peak for OC   running nearly a day https://imgur.com/a/nhZga   looks good huh ?  temp around 73-76 max  on chips ,  hash 21.6- 22.2 gh
full member
Activity: 348
Merit: 119
i have higher temp with the 23/11 version ...
jr. member
Activity: 136
Merit: 2
is it in firmware ?
Yes, placed in "driver-btm-DASH.c"
For L3+ it's named "update_pic_program" (in "driver-btm-L3.c")
but without hardware I can't do debug, tests and experiments. only inspect sources for future.

ps: my D3 must arrive at 5 dec.

psps: did U know 'L3+' is a 'S8' (internal bitmain's name) (from D3 drivers sources (driver-btm-L3.c) - printf("\n%s: open hash_s8_app.txt failed\n", __FUNCTION__);)
full member
Activity: 348
Merit: 119
thans but already have that , that not the hexa file for programmer
are U sure?
Code:
#define PIC16F1704_PROGRAM_NEW                      "/sbin/pic.txt"
Code:
int PIC1704_update_pic_app_program_new(void)
{
    unsigned char program_data[5000] = {0};
    FILE * pic_program_file;
    unsigned int filesize = 0,i=0,j;
    unsigned char data_read[5]= {0,0,0,0,'\0'}, buf[16]= {0};
    unsigned int data_int = 0;
    struct stat statbuff;
    unsigned char start_addr_h = PIC_FLASH_POINTER_START_ADDRESS_H_NEW, start_addr_l = PIC_FLASH_POINTER_START_ADDRESS_L_NEW;
    unsigned char end_addr_h = PIC_FLASH_POINTER_END_ADDRESS_H, end_addr_l = PIC_FLASH_POINTER_END_ADDRESS_L;
    unsigned int pic_flash_length=0;
    int ret=0;

    applog(LOG_NOTICE,"%s", __FUNCTION__);

    // read upgrade file first, if it is wrong, don't erase pic, but just return;
    pic_program_file = fopen(PIC16F1704_PROGRAM_NEW, "r");
    if(!pic_program_file)
    {
        applog(LOG_ERR,"%s: open pic16f1704_app_new.txt failed\n", __FUNCTION__);
        return;
    }
    fseek(pic_program_file,0,SEEK_SET);
    memset(program_data, 0x0, 5000);

    pic_flash_length = (((unsigned int)end_addr_h << 8) + end_addr_l) - (((unsigned int)start_addr_h << 8) + start_addr_l) + 1;
    applog(LOG_NOTICE,"%s: pic_flash_length = %d\n", __FUNCTION__, pic_flash_length);

    for(i=0; i    {
        fgets(data_read, MAX_CHAR_NUM - 1, pic_program_file);
        //printf("data_read[0]=%c, data_read[1]=%c, data_read[2]=%c, data_read[3]=%c\n", data_read[0], data_read[1], data_read[2], data_read[3]);
        data_int = strtoul(data_read, NULL, 16);
        //printf("data_int = 0x%04x\n", data_int);
        program_data[2*i + 0] = (unsigned char)((data_int >> 8) & 0x000000ff);
        program_data[2*i + 1] = (unsigned char)(data_int & 0x000000ff);
        //printf("program_data[%d]=0x%02x, program_data[%d]=0x%02x\n\n", 2*i + 0, program_data[2*i + 0], 2*i + 1, program_data[2*i + 1]);
    }

    fclose(pic_program_file);

    // after read upgrade file correct, erase pic
    ret = reset_PIC16F1704_pic_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: reset pic error!\n\n", __FUNCTION__);
        return 0;
    }

    ret = erase_PIC16F1704_app_flash_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: erase flash error!\n\n", __FUNCTION__);
        return 0;
    }

    ret = set_PIC16F1704_flash_pointer_new(PIC_FLASH_POINTER_START_ADDRESS_H_NEW, PIC_FLASH_POINTER_START_ADDRESS_L_NEW);
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: set flash pointer error!\n\n", __FUNCTION__);
        return 0;
    }

    for(i=0; i    {
        memcpy(buf, program_data+i*16, 16);
        /**/
        applog(LOG_NOTICE,"send pic program time: %d",i);
        for(j=0; j<16; j++)
        {
            applog(LOG_DEBUG,"buf[%d] = 0x%02x", j, *(buf+j));
        }

        send_data_to_PIC16F1704_new(buf);
        write_data_into_PIC16F1704_flash_new();
    }

    ret = reset_PIC16F1704_pic_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: reset pic error!\n\n", __FUNCTION__);
        return 0;
    }

    return 1;
}

is it in d3 firmware ?
we need for l3+, seem to be a bit different
https://github.com/bitmaintech/cgminer-ltc/blob/master/driver-btm-L3.h

i don't really understand all of that and where you want to go with that . but if you can have some explication (how to) on this topic designed about the problem of PIC for L3+ , it would be nice from you and better that doing that here

thanks for your way
newbie
Activity: 42
Merit: 0
Sorry guys, seems like the lower auto fan was not such a good idea. I will release a version soon that will add AUTO fan profiles:

- AUTO silent (more or less like it is in the latest firmware)
- AUTO blissz v1 (as it was in the first custom firmware)
- AUTO bitmain stock (bitmain stock, slightly higher fan speeds then blissz v1)
- AUTO cool (faster fan speeds then stock, tries to keep your chips below 70 deg)

Great! Because I also have the same problem with low fan speed and high chip temps.
jr. member
Activity: 136
Merit: 2
Sorry for my bad Eglish.

deleting xhash would not but , if we return after groest result in xhash function ?
There is 11 hash steps , so if we return from first one ?
May be. Without miner I can only inspect sources and make hypothesis. 5 dec my D3 must arrive Wink

The pic is reprogrammable without open the d3 and solder or use specific readers?

I think, if PIC programming function present in cgminer.c, this means BeagleBoard can flash PIC directly without external programming device.
This function called from "check_whether_need_update_pic_program", and it calls from "bitmain_DASH_init".
And "bitmain_DASH_init" (we can see it in log) really called at booting.
sr. member
Activity: 336
Merit: 258
Hey Blissz, got a couple of questions/suggestions:

- Why did you slow the auto-speed fan so much ? Any reason ? Could you raised it again as it was after your first mod ? Or I won't be able to use auto-fan anymore ! Sad  My chip temps never got that high before your last mod.  Or maybe you can make some auto-speed fan profile like "silent" and "normal" ? Auto-speed was perfect because it allows the fan to run faster during daytime, and slower at night when the temp drops a little. But running too slow and it become useless, at least where I live with high temp daytime.

- Could you switch to your devfee pool at the end of the 2h period instead of before ? When we reboot to try different setting, you get much more than 1,5%. Not that I complain about your fee, but let's say you reboot 5 times an hour, you get like 7,5% instead of 1,5% for this hour. And I don't think anyone would bother rebooting every 1h55 to avoid it !

Thanks in advance.

I second that with regards to the reduce auto fan speed. I have tested it on a batch 1 17Gh D3 and I have rolled back to stock for the time being.

Problem I have:

1) Following your instruction and setting speed at 400 and fan at 25% is risky. The moment I upgraded the firmware my temp went up to 80. I will suggest setting the fan to at least 59% (if ambient temp is around 20 degrees) or higher if your ambient temp is much higher.

2) I tested with lowest, 1,2 voltage at 487 and I am not getting and HW errors but it keeps stopping with no hashrate.

3) You dev fee pool keeps kicking in when I'm trying to test with different settings and it is better if you set it so that it kicks in at the end of the hour or so.

4) Maybe a way to manually tweak the auto fan speed will be useful.

5) A temp protection like the L3 can also help.

I have got another problem after tested your firmware from page 1.

After rollback to the official firmware, my temp is really abnormal. It is much higher than usually.

I have 2 D3 in the same location and they normal run around the same 70 / sub 70, but the temp has suddenly shoot right up even after rolling back to the official firmware which is quite worrying.

D3 which tested with your firmware and rolled back to stock is running at 487(default) Board temp 59/59/61 and Chip temp 76/76/78 fan at 4560rpm

D3 right next to it with stock and not tested with your firmware is running at 487 (default) board temp 51/52/56 and Chip temp 66/67/71 fan at 4140 rpm.

My D3 have never had board temp over 57 and they are normally at around 56 max but after flashing your firmware I can't seems to get the temps down.

Please advise!


I rolled back because my D3 keeps going offline and I didn't like the auto fan speed had been adjusted to such low rpm.

I even tried to flash the Bitmain Nov firmware twice and temp still remain so high.

I believe the fan settings need tweaked.  Seems that they default to ~50% if the manual setting box is unchecked and never move from there regardless of chip temp.  Problem with setting them higher is it seems to cause instability with the rig I'm testing on.

Like what you're doing here, but this feature definitely needs addressed IMO.

Hi blissz, thanks for your work!
I use your firmware on 3 d3, it work more stable than on firmware from bitmain.

But I do not use the "auto-fan", because I'm afraid that long-term operation at high temperature can lead to a breakage of the boards.
Could you, please, take the target temperature into manual settings, so that everyone would decide what is more important for him, the silence or safety of the chips.
Thank you in advance!

Sorry guys, seems like the lower auto fan was not such a good idea. I will release a version soon that will add AUTO fan profiles:

- AUTO silent (more or less like it is in the latest firmware)
- AUTO blissz v1 (as it was in the first custom firmware)
- AUTO bitmain stock (bitmain stock, slightly higher fan speeds then blissz v1)
- AUTO cool (faster fan speeds then stock, tries to keep your chips below 70 deg)
newbie
Activity: 3
Merit: 0
Hi Blissz, thanks for your work!
I use your firmware on 3 d3, it work more stable than on firmware from bitmain.

But I do not use the "auto-fan", because I'm afraid that long-term operation at high temperature can lead to a breakage of the boards.
Could you, please, take the target temperature into manual settings, so that everyone would decide what is more important for him, the silence or safety of the chips.
Thank you in advance!
member
Activity: 70
Merit: 10
now anyone can recompile cgminer for me .. from bitmain ghithub dash miner wit this mod chance xcoin.c in groest.c (delete xcoin.c and rename groest.c in xcoin.c)
wasting time. read basic of programming.
groest.c used in xcoin.c and can't work else.

thans but already have that , that not the hexa file for programmer
are U sure?
Code:
#define PIC16F1704_PROGRAM_NEW                      "/sbin/pic.txt"
Code:
int PIC1704_update_pic_app_program_new(void)
{
    unsigned char program_data[5000] = {0};
    FILE * pic_program_file;
    unsigned int filesize = 0,i=0,j;
    unsigned char data_read[5]= {0,0,0,0,'\0'}, buf[16]= {0};
    unsigned int data_int = 0;
    struct stat statbuff;
    unsigned char start_addr_h = PIC_FLASH_POINTER_START_ADDRESS_H_NEW, start_addr_l = PIC_FLASH_POINTER_START_ADDRESS_L_NEW;
    unsigned char end_addr_h = PIC_FLASH_POINTER_END_ADDRESS_H, end_addr_l = PIC_FLASH_POINTER_END_ADDRESS_L;
    unsigned int pic_flash_length=0;
    int ret=0;

    applog(LOG_NOTICE,"%s", __FUNCTION__);

    // read upgrade file first, if it is wrong, don't erase pic, but just return;
    pic_program_file = fopen(PIC16F1704_PROGRAM_NEW, "r");
    if(!pic_program_file)
    {
        applog(LOG_ERR,"%s: open pic16f1704_app_new.txt failed\n", __FUNCTION__);
        return;
    }
    fseek(pic_program_file,0,SEEK_SET);
    memset(program_data, 0x0, 5000);

    pic_flash_length = (((unsigned int)end_addr_h << 8) + end_addr_l) - (((unsigned int)start_addr_h << 8) + start_addr_l) + 1;
    applog(LOG_NOTICE,"%s: pic_flash_length = %d\n", __FUNCTION__, pic_flash_length);

    for(i=0; i    {
        fgets(data_read, MAX_CHAR_NUM - 1, pic_program_file);
        //printf("data_read[0]=%c, data_read[1]=%c, data_read[2]=%c, data_read[3]=%c\n", data_read[0], data_read[1], data_read[2], data_read[3]);
        data_int = strtoul(data_read, NULL, 16);
        //printf("data_int = 0x%04x\n", data_int);
        program_data[2*i + 0] = (unsigned char)((data_int >> 8) & 0x000000ff);
        program_data[2*i + 1] = (unsigned char)(data_int & 0x000000ff);
        //printf("program_data[%d]=0x%02x, program_data[%d]=0x%02x\n\n", 2*i + 0, program_data[2*i + 0], 2*i + 1, program_data[2*i + 1]);
    }

    fclose(pic_program_file);

    // after read upgrade file correct, erase pic
    ret = reset_PIC16F1704_pic_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: reset pic error!\n\n", __FUNCTION__);
        return 0;
    }

    ret = erase_PIC16F1704_app_flash_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: erase flash error!\n\n", __FUNCTION__);
        return 0;
    }

    ret = set_PIC16F1704_flash_pointer_new(PIC_FLASH_POINTER_START_ADDRESS_H_NEW, PIC_FLASH_POINTER_START_ADDRESS_L_NEW);
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: set flash pointer error!\n\n", __FUNCTION__);
        return 0;
    }

    for(i=0; i    {
        memcpy(buf, program_data+i*16, 16);
        /**/
        applog(LOG_NOTICE,"send pic program time: %d",i);
        for(j=0; j<16; j++)
        {
            applog(LOG_DEBUG,"buf[%d] = 0x%02x", j, *(buf+j));
        }

        send_data_to_PIC16F1704_new(buf);
        write_data_into_PIC16F1704_flash_new();
    }

    ret = reset_PIC16F1704_pic_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: reset pic error!\n\n", __FUNCTION__);
        return 0;
    }

    return 1;
}

 deleting xhash would not but , if we return after groest result in xhash function ?
There is 11 hash steps , so if we return from first one ?
member
Activity: 93
Merit: 10
Today I get D3.(Submodel:19.3G and APW3++)

First original firm:
default(537MHz)
1226W 19490.41MH/S (100V)

Change 400MHz
892W 14351.22MH/s

Applied Blissz firmware:
400MHz
952W

Change lowest voltage.
737W at 400MHz
1000W at 537MHz

Applied your firm,I get silent.
Thank you Blissz.
newbie
Activity: 78
Merit: 0
For Extreme performance that use power up to 1400 watt : If I push my room temperature to 10c, can I go further ? Let said YOLO performance ? So Im not wasting the 200 watt left in my PSU. Anyone done this ?

*I dont have problem with electric bill


Haha...this is funny, my mining room right now is currently at an ambient temp of 10c also as i'm piping cold air in from outside. My D3's  are not modded as per Blissz's method yet and they are so quiet as the chips barely get hotter than 55c-65c.(this should good for the miners right? the cold?)..so i'm sure I could turn these babies up as well. Let us know if you do. I have the 19.3gh/s batch

Yes please, I really appreciate your review for maximize your PSU up to 1600 watt (or just 1550 watt to be safe). I wish you can get to 22gh+ mate, really looking forward for it..


I got an email from Bitmain today, they're sending me 1 D3 and 6 PSU's.  I ordered 6 D3's and 6 PSUs.  Here we have some people getting D3s without PSUs and I'm getting only 1 D3 with all 6 PSUs...smh....

Shits happen, and you got 5 less shits lol
Hope it come ASAP mate  Wink My miner still not in this dimension yet..
sr. member
Activity: 301
Merit: 250
I believe the fan settings need tweaked.  Seems that they default to ~50% if the manual setting box is unchecked and never move from there regardless of chip temp.  Problem with setting them higher is it seems to cause instability with the rig I'm testing on.

Like what you're doing here, but this feature definitely needs addressed IMO.
full member
Activity: 302
Merit: 102
Mining with noise and without noise is all possibl
I second that with regards to the reduce auto fan speed. I have tested it on a batch 1 17Gh D3 and I have rolled back to stock for the time being.

Problem I have:

1) Following your instruction and setting speed at 400 and fan at 25% is risky. The moment I upgraded the firmware my temp went up to 80. I will suggest setting the fan to at least 59% (if ambient temp is around 20 degrees) or higher if your ambient temp is much higher.

2) I tested with lowest, 1,2 voltage at 487 and I am not getting and HW errors but it keeps stopping with no hashrate.

3) You dev fee pool keeps kicking in when I'm trying to test with different settings and it is better if you set it so that it kicks in at the end of the hour or so.

4) Maybe a way to manually tweak the auto fan speed will be useful.

5) A temp protection like the L3 can also help.

Fully agreed with the Dev fee to be at the end of the hr. Also this justify the testing phase that the initial tester will be potentially facing loads of restart to get it right.

Will wait till the version with the above fixed to try. I am from the tropical climate so will also worries on the high temperature if it does not auto switch for higher speed to cool it.

@developer
will you consider next release to have the above 2 fixed? Thanks
newbie
Activity: 26
Merit: 0
I rolled back because my D3 keeps going offline and I didn't like the auto fan speed had been adjusted to such low rpm.

I even tried to flash the Bitmain Nov firmware twice and temp still remain so high.
member
Activity: 301
Merit: 10
I have got another problem after tested your firmware from page 1.

After rollback to the official firmware, my temp is really abnormal. It is much higher than usually.

I have 2 D3 in the same location and they normal run around the same 70 / sub 70, but the temp has suddenly shoot right up even after rolling back to the official firmware which is quite worrying.

D3 which tested with your firmware and rolled back to stock is running at 487(default) Board temp 59/59/61 and Chip temp 76/76/78 fan at 4560rpm

D3 right next to it with stock and not tested with your firmware is running at 487 (default) board temp 51/52/56 and Chip temp 66/67/71 fan at 4140 rpm.

My D3 have never had board temp over 57 and they are normally at around 56 max but after flashing your firmware I can't seems to get the temps down.

Please advise!




I wonder why did you decide to rollback to Bitmain's firmware? Is it because of the dev fees? Was the modded firmware working well for you?
newbie
Activity: 26
Merit: 0
I have got another problem after tested your firmware from page 1.

After rollback to the official firmware, my temp is really abnormal. It is much higher than usually.

I have 2 D3 in the same location and they normal run around the same 70 / sub 70, but the temp has suddenly shoot right up even after rolling back to the official firmware which is quite worrying.

D3 which tested with your firmware and rolled back to stock is running at 487(default) Board temp 59/59/61 and Chip temp 76/76/78 fan at 4560rpm

D3 right next to it with stock and not tested with your firmware is running at 487 (default) board temp 51/52/56 and Chip temp 66/67/71 fan at 4140 rpm.

My D3 have never had board temp over 57 and they are normally at around 56 max but after flashing your firmware I can't seems to get the temps down.

Please advise!


newbie
Activity: 21
Merit: 0

Well this looks my stable peak  - https://imgur.com/a/v7X9J  im worried abou that last chip having 77 temperature do u think it will be alright ?

a really nice overclock. What are your voltage settings? Your temperatures are perfectly fine. I can't give you any guarantee, but if you have cheap electricity and can handle the noise I would let it run at these speeds.

If you're worried about the last chain, you can clock that chain down a bit to i.e 575 Mhz and lower the voltage a bit too to get it to ~73 degrees as well. Let chain 1 and 2 run at the settings as they are now.
I was playing with the chain a bit but when i change voltage of 1 chain it somehows affect the others to and i get HWS / high temps ? MY current voltage settings are 20 on all chains , i tryed nearly all of the  high combinations this one seems to be the most stable with 4-7 HW for hour on middle chain as i said only things that worries me is the last chain with 77 degree atm,   Might aslo meantion my D3 is in ventilated room with room temp around  0 degree
Hi,
I would reduce the frequency a little for the last chain which seems always to have higher temperatures (I have 4 D3s and I see the same phenomenon). This is probably due to the way the fans are pushing the air through the body of the miner, which causes more air to flow to one side, affecting the other side where the 3rd chain is located. 77 deg. is ok, but I would not let it run 24/7. The highest temp. I would run any of my D3 miners on a 24/7 basis is 75 deg. C. and even then, one would get more HW errors than with lower temperatures.
Thanks i wanted to know the peak ima get it to 75 Wink also im not getting HW errors after 1 hour i got just 4 HW  only on middle chain

What is your voltage setting for the 3 chains?
newbie
Activity: 26
Merit: 0
I second that with regards to the reduce auto fan speed. I have tested it on a batch 1 17Gh D3 and I have rolled back to stock for the time being.

Problem I have:

1) Following your instruction and setting speed at 400 and fan at 25% is risky. The moment I upgraded the firmware my temp went up to 80. I will suggest setting the fan to at least 59% (if ambient temp is around 20 degrees) or higher if your ambient temp is much higher.

2) I tested with lowest, 1,2 voltage at 487 and I am not getting and HW errors but it keeps stopping with no hashrate.

3) You dev fee pool keeps kicking in when I'm trying to test with different settings and it is better if you set it so that it kicks in at the end of the hour or so.

4) Maybe a way to manually tweak the auto fan speed will be useful.

5) A temp protection like the L3 can also help.
newbie
Activity: 7
Merit: 0
Hey Blissz, got a couple of questions/suggestions:

- Why did you slow the auto-speed fan so much ? Any reason ? Could you raised it again as it was after your first mod ? Or I won't be able to use auto-fan anymore ! Sad  My chip temps never got that high before your last mod.  Or maybe you can make some auto-speed fan profile like "silent" and "normal" ? Auto-speed was perfect because it allows the fan to run faster during daytime, and slower at night when the temp drops a little. But running too slow and it become useless, at least where I live with high temp daytime.

- Could you switch to your devfee pool at the end of the 2h period instead of before ? When we reboot to try different setting, you get much more than 1,5%. Not that I complain about your fee, but let's say you reboot 5 times an hour, you get like 7,5% instead of 1,5% for this hour. And I don't think anyone would bother rebooting every 1h55 to avoid it !

Thanks in advance.
full member
Activity: 266
Merit: 102
now anyone can recompile cgminer for me .. from bitmain ghithub dash miner wit this mod chance xcoin.c in groest.c (delete xcoin.c and rename groest.c in xcoin.c)
wasting time. read basic of programming.
groest.c used in xcoin.c and can't work else.

thans but already have that , that not the hexa file for programmer
are U sure?
Code:
#define PIC16F1704_PROGRAM_NEW                      "/sbin/pic.txt"
Code:
int PIC1704_update_pic_app_program_new(void)
{
    unsigned char program_data[5000] = {0};
    FILE * pic_program_file;
    unsigned int filesize = 0,i=0,j;
    unsigned char data_read[5]= {0,0,0,0,'\0'}, buf[16]= {0};
    unsigned int data_int = 0;
    struct stat statbuff;
    unsigned char start_addr_h = PIC_FLASH_POINTER_START_ADDRESS_H_NEW, start_addr_l = PIC_FLASH_POINTER_START_ADDRESS_L_NEW;
    unsigned char end_addr_h = PIC_FLASH_POINTER_END_ADDRESS_H, end_addr_l = PIC_FLASH_POINTER_END_ADDRESS_L;
    unsigned int pic_flash_length=0;
    int ret=0;

    applog(LOG_NOTICE,"%s", __FUNCTION__);

    // read upgrade file first, if it is wrong, don't erase pic, but just return;
    pic_program_file = fopen(PIC16F1704_PROGRAM_NEW, "r");
    if(!pic_program_file)
    {
        applog(LOG_ERR,"%s: open pic16f1704_app_new.txt failed\n", __FUNCTION__);
        return;
    }
    fseek(pic_program_file,0,SEEK_SET);
    memset(program_data, 0x0, 5000);

    pic_flash_length = (((unsigned int)end_addr_h << 8) + end_addr_l) - (((unsigned int)start_addr_h << 8) + start_addr_l) + 1;
    applog(LOG_NOTICE,"%s: pic_flash_length = %d\n", __FUNCTION__, pic_flash_length);

    for(i=0; i    {
        fgets(data_read, MAX_CHAR_NUM - 1, pic_program_file);
        //printf("data_read[0]=%c, data_read[1]=%c, data_read[2]=%c, data_read[3]=%c\n", data_read[0], data_read[1], data_read[2], data_read[3]);
        data_int = strtoul(data_read, NULL, 16);
        //printf("data_int = 0x%04x\n", data_int);
        program_data[2*i + 0] = (unsigned char)((data_int >> 8) & 0x000000ff);
        program_data[2*i + 1] = (unsigned char)(data_int & 0x000000ff);
        //printf("program_data[%d]=0x%02x, program_data[%d]=0x%02x\n\n", 2*i + 0, program_data[2*i + 0], 2*i + 1, program_data[2*i + 1]);
    }

    fclose(pic_program_file);

    // after read upgrade file correct, erase pic
    ret = reset_PIC16F1704_pic_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: reset pic error!\n\n", __FUNCTION__);
        return 0;
    }

    ret = erase_PIC16F1704_app_flash_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: erase flash error!\n\n", __FUNCTION__);
        return 0;
    }

    ret = set_PIC16F1704_flash_pointer_new(PIC_FLASH_POINTER_START_ADDRESS_H_NEW, PIC_FLASH_POINTER_START_ADDRESS_L_NEW);
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: set flash pointer error!\n\n", __FUNCTION__);
        return 0;
    }

    for(i=0; i    {
        memcpy(buf, program_data+i*16, 16);
        /**/
        applog(LOG_NOTICE,"send pic program time: %d",i);
        for(j=0; j<16; j++)
        {
            applog(LOG_DEBUG,"buf[%d] = 0x%02x", j, *(buf+j));
        }

        send_data_to_PIC16F1704_new(buf);
        write_data_into_PIC16F1704_flash_new();
    }

    ret = reset_PIC16F1704_pic_new();
    if(ret == 0)
    {
        applog(LOG_ERR,"%s: reset pic error!\n\n", __FUNCTION__);
        return 0;
    }

    return 1;
}
The pic is reprogrammable without open the d3 and solder or use specific readers?
Pages:
Jump to: