This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can I read MAC ID into unsigned char?

Controller: TMC1294NCPDT 

I am actually in a requirement, where I want to read the MAC ID, which has already been programmed, into a unsigned char and manipulate the MAC ID as a string. Is it Possible? Help is needed.

Thanks,

Regards 

Chaitanya.

  • Hello Chaitanya,

    "enet_lwip" example already stores the Ethernet MAC address into an array of "unsigned uint8_t". Did you refer that example?

    Why to you want to manipulate the MAC address as a string?

    Thanks,
    Sai
  • Well I am currently FlashUserGet instruction and trying to write the address into a string. 

    FlashUserGet(&ulUser0, &ulUser1);

    sprintf(buf,"[ %2x- ]\n", ((ulUser0 >>  0) & 0xff));

       if(buf[0] == ' ')

    sprintf(buf,"%2x-\n", ((ulUser0 >> 8) & 0xff));
    if(buf[0] == ' ')
    buf[0] = '0';
    buf[strlen(buf)]='\0';
    UART_write(uart,buf,strlen(buf));

     

       and when I am trying to print the data, it is giving me something like this

    ,

    I have checked the example, you have suggested, but I am bound to use FlashUserGet.

     

  • Solution found to my problem, after debugging a bit, I found that, my MAC address has been reset, to 0x000, and also I was using integer to char to read MAC address.
    Then I changed it to uint32_t. Well it is partially working.

    if (!FlashUserSet(ulUser0, ulUser1) ) // here FLASH_USER0 become 0 and FLASH_USER1 0x400

    {
    sprintf(txBuffer,"Flash OK %x %x\n",ulUser0, ulUser1);
    UART_write(uart,txBuffer,strlen(txBuffer));
    }