It is currently 15 Oct 2018 20:06

All times are UTC + 1 hour




Post new topic Reply to topic  [ 90 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
PostPosted: 22 Mar 2011 15:59 
Offline

Joined: 11 Sep 2007 21:15
Posts: 33
Location: Shropshire, United Kingdom
Thank You Florin,

I appreciate the time you have given to the community.

PS. Could I be cheeky and ask about UDP bootloader for MP Pro for 18f87j60.
your Zabbix bootloader libraries don't seem to cover the 18f87j60.

Thanks again.


Top
 Profile  
 
PostPosted: 22 Mar 2011 16:44 
Offline

Joined: 19 Sep 2006 12:57
Posts: 1868
Location: Romania, Arad City
Hi,

I made some changes in bootloader... You can find UDP bootloader here: http://www.microelemente.ro/MikroPascal ... xample.zip

_________________
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro


Top
 Profile  
 
PostPosted: 26 Mar 2011 15:19 
Offline

Joined: 24 Oct 2009 16:01
Posts: 47
Location: Colombia
Good day,

In the past:

juanelectro wrote:
Good day,

I send information from my own board to a server and sometimes board doesn't ping and it is necessary to reset it and connection comes back, it would be good to resolve problem in both situations (link up and down).


Thanks for attention.


somebody can resolve my question?


Thanks


Top
 Profile  
 
PostPosted: 29 Mar 2011 16:50 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3764
Location: Nieuwpoort, Belgium
Ref: http://www.mikroe.com/forum/viewtopic.php?f=93&t=19970&start=39

Hi all, the SDMMC_SPIx.mpas routine published in above link can be extended with routines to extract the "CSD" and the "CID" of the SD/MMC card.
The CSD can e.g. be used to calculate the raw disk capacity, the CID to identify the manufacturer etc...

Florin will publish a version of SDMMC_SPIx with the CID/CSD routines are included. Thanks in advance Florin!


Here are the additional routines for SDMMC_SPIx:

function SDMMC_Read_Csd(var data_for_registers: array[16] of byte): byte;
function SDMMC_Read_Cid(var data_for_registers: array[16] of byte): byte;

function SDMMC_read_cid_csd(var data_for_registers: array[16] of byte; csd_: boolean): byte;
var Index : Word;
    TimeOut : Byte;
    Cmd: byte;
begin
  Result := 1;                           // error
  if cardtype = 0 then exit;             // no card

  if csd_
  then Cmd := CMD9                       // Send CSD
  else Cmd := CMD10;                     // Send CID

  TimeOut := 0;
 
  while result = 1 do
  begin
    SDMMC_CS := 0;                       // select card
    nop;
    nop;
    if SendCmd(Cmd, 0) = $00 then        // Send Cmd "send CSD/CID"
    if SeekResponse($FE) = $FE then      // Read start token
    begin
      Index := 0;
      FSR2 := word(@data_for_registers);
      while Index < 16 do                // Read data block, 16 bytes
      begin
        SDMMC_Read;                      // Result = in R18
        POSTINC2 := R18;
        Inc(Index);
      end;
      SDMMC_Read;                        // Read dummy CRC to conclude data block
      SDMMC_Read;
      result := 0;                       // Read completed successfully
    end;
    SDMMC_CS := 1;                       // de-select card
    nop;
    nop;
    SDMMC_Read;                          // Clock SD/MMC to complete read
    if Inc(TimeOut) > 1 then break;      // 2 tries
  end;
end;

function SDMMC_Read_Csd(var data_for_registers: array[16] of byte): byte;
begin
  Result :=  SDMMC_read_cid_csd(data_for_registers, true);
end;

function SDMMC_Read_Cid(var data_for_registers: array[16] of byte): byte;
begin
  Result :=  SDMMC_read_cid_csd(data_for_registers, false);
end;




Things that can be done with the CID/CSD:

procedure SDMMC_CID_CSD_mirror(var dat: array[16] of byte);
// mirrors the 16 byte array: the MSB is in position 0 (was read in first)
var I, Tmp: byte;
begin
  for I := 0 to 7 do
  begin
    Tmp := Dat[I];
    Dat[I] := Dat[15-I];
    Dat[15-I] := Tmp;
  end;
end;

function SDMMC_CardSize: DWord;
// Returns the raw size of the card in bytes
// Doc: http://www.sdcard.org/developers/tech/sdcard/pls/simplified_specs/Part_1_Physical_Layer_Simplified_Specification_Ver3.01_Final_100518.pdf
var Dat: array[16] of byte;
    I, error: byte;
    Csd_Struct, C_size_mult, Read_Bl_Len: byte;
    C_size: Dword;
begin
  Result := 0;
  error := SDMMC_Read_Csd(Dat);

  if error = 0 then
  begin

    //mirror the data array: the MSB was read in first, we want it otherwise for Get_Bits
    SDMMC_CID_CSD_mirror(Dat);

    Csd_Struct := Get_Bits(Dat, 126, 127);
    if Csd_Struct = 0 then
    begin
      C_Size      := Get_Bits(Dat, 62, 73);
      C_Size_Mult := Get_Bits(Dat, 47, 49);
      Read_Bl_Len := Get_Bits(Dat, 80, 83);
      Result      := (C_Size + 1) * ( 1 shl (c_Size_mult + 2)) * (1 shl Read_Bl_Len);
    end
    else
    if Csd_Struct = 1 then
    begin
      C_Size := Get_Bits(Dat, 48, 69);
      Result := (C_Size + 1) * 512 * 1024;
    end;
  end;
end;

procedure SDMMC_ProductName(var S: string[5]);
var Dat: array[16] of byte;
    error, I1, I2: byte;
begin
  S := '';
  error :=  SDMMC_Read_Cid(Dat);
  if error = 0 then
  begin
    I2 := 3; //start with byte 3 of the Cid
    for I1 := 0 to 4 do // a 5 char string
    begin
      S[I1] := Dat[I2];
      inc(I2);
    end;
    S[5] := 0;
  end;
end;

procedure SDMMC_ProductRevision(var S: string[3]);
var Dat: array[16] of byte;
    error, Prv, Tmp: byte;
begin
  S := '';
  error :=  SDMMC_Read_Cid(Dat);
  if error = 0 then
  begin
    Prv := Dat[8]; // get the product revision (bcd number)

    Tmp := Prv shr 4; // get high order nibble
    Tmp := Tmp + 48;  // make it ascii
    S[0] := Tmp;

    Tmp := Prv and $0f; // get low order nibble
    Tmp := Tmp + 48;    // make it ascii
    S[2] := Tmp;

    S[1] := '.';
    S[3] := 0;
  end;
end;

function SDMMC_ProductSerialNumber: DWord;
var Dat: array[16] of byte;
    error: byte;
begin
  Result := 0;
  error := SDMMC_Read_Cid(Dat);
  if error = 0 then
  begin
    SDMMC_CID_CSD_mirror(Dat);

    Result := Get_Bits(Dat, 24, 55);
  end;
end;

procedure SDMMC_ProductManufacturingDate(var S: string[7]);
// returns the manufacturing date in format mm/yyyy
var Dat: array[16] of byte;
    error: byte;
    Mo: byte;
    Yr: word;
    TmpS: string[5];
begin
  S := '';
  error :=  SDMMC_Read_Cid(Dat);
  if error = 0 then
  begin
    SDMMC_CID_CSD_mirror(Dat);

    Mo := Get_Bits(Dat, 8, 11);
    Yr := Get_Bits(Dat, 12,19);
    Yr := Yr + 2000;

    ByteToStr(Mo, TmpS);
    trim(TmpS);
    StrCat(S, TmpS);

    WordToStr(Yr, TmpS);
    Trim(TmpS);
    StrCat(S, '/');
    StrCat(S, TmpS);
  end;
end;
Above code uses the unit "BitUtils" (http://www.rosseeld.be/DRO/PIC/index.htm#BitUtils) to fetch bitgroups out of the CSD/CID.

Enjoy!

_________________
Kind regards, Dany.
There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
PostPosted: 04 Jul 2011 14:42 
Offline

Joined: 04 Mar 2011 23:28
Posts: 3
We used yo2lio's ENC library in order to send TCP request to our server. We succeeded when we send request via port 80, but we couldn't reach our Java application which works with port 8080. We managed to open port 8080 and establish connection via port 8080 on both sides, but result of function Send_TCP via port 8080 is always false. Same procedure works perfect with port 80, we manage to get response from the server. Also Java application is responding when we send request to port 8080 from local computer.

Any ideas?

Bet regards
Uros Pesovic


Top
 Profile  
 
PostPosted: 20 Jul 2011 14:47 
Offline

Joined: 19 Sep 2006 12:57
Posts: 1868
Location: Romania, Arad City
Hi,

I updated the libraries.

I made small changes in Ethernet libraries and it's strongly recommended to update this...

MP4.60 : http://www.microelemente.ro/MikroPascal ... y_V1_5.rar

MP5.00 : http://www.microelemente.ro/MikroPascal ... y_V1_6.rar

_________________
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro


Top
 Profile  
 
PostPosted: 20 Jul 2011 19:07 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3764
Location: Nieuwpoort, Belgium
yo2lio wrote:
Hi,

I updated the libraries.

I made small changes in Ethernet libraries and it's strongly recommended to update this...

MP4.60 : http://www.microelemente.ro/MikroPascal ... y_V1_5.rar

MP5.00 : http://www.microelemente.ro/MikroPascal ... y_V1_6.rar

Thanks! :D :D

_________________
Kind regards, Dany.
There is a crack in everything, that's how the light gets in... (L. Cohen)


Top
 Profile  
 
PostPosted: 24 Jul 2011 11:12 
Offline

Joined: 17 Dec 2009 08:17
Posts: 27
Hello Florin

Thanks for the new libraries.
Unfortunately I can not find the MP5.00 Version on your homepage

Erwin


Top
 Profile  
 
PostPosted: 01 Aug 2011 09:16 
Offline

Joined: 19 Sep 2006 12:57
Posts: 1868
Location: Romania, Arad City
aldis wrote:
Hello Florin

Thanks for the new libraries.
Unfortunately I can not find the MP5.00 Version on your homepage

Erwin


Solved.
Sorry for trouble...

_________________
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro


Top
 Profile  
 
PostPosted: 01 Aug 2011 11:28 
Offline

Joined: 17 Dec 2009 08:17
Posts: 27
Thanks :D :D


Top
 Profile  
 
PostPosted: 04 Mar 2012 21:47 
Offline

Joined: 28 Jun 2011 11:21
Posts: 156
Hi there. Just a dumb question. Im using Mikrobasic and the libaries i found on the site from YO2LIO are written in Pascal. Are there any way that these libraries are available in Basic or compiled as stand alone files and not running with an installer? I find them (The once i could use) very usefull but some lib's are not there. Only in the compiled version with installer and i don't have mikroPascal only mikroBasic.


Top
 Profile  
 
PostPosted: 17 Oct 2013 09:59 
Offline

Joined: 15 Oct 2009 14:26
Posts: 8
Hello everyone,
I have problem with UDP bootloader. I just can't make it work. Can someone please help me.
I have mikroPascal PRO v4.60 (this is unfortunately only older version I could find, because with version 6.0.0 I had compile issues). Also, I have downloaded: http://www.microelemente.ro/MikroPascal ... y_V1_5.rar and http://www.microelemente.ro/MikroPascal ... xample.zip

After installing mP v4.6 I can compile entire project (UDP Bootloader V7 ZABBIX) without errors, but I can't ping my board. My board has PIC18F86J60 MCU with 25MHz OSC. Unfortunately I can't debug it with mP because it's homemade. Problem should't be in board itself because I have thoroughly tested it and I have mC HTTP Demo running on it without any problems. Using wireshark I have determined that my board with UDP bootloader doesn't respond to ARP requests.

P.S.
I tested it booth with 1 and also with 0 on RB6.
Also, I would like to mention that I haven't change anything in code except MCU.

CFG:
<?xml version="1.0"?>
<MCU_DEVICE_FLAGS>
<DEVICE>
<DEVICE_NAME>P18F86J60</DEVICE_NAME>
<VALUE>
<COUNT>6</COUNT>
<VALUE0>
<VAL>$00FFF8:$00A0</VAL>
</VALUE0>
<VALUE1>
<VAL>$00FFF9:$0004</VAL>
</VALUE1>
<VALUE2>
<VAL>$00FFFA:$00C5</VAL>
</VALUE2>
<VALUE3>
<VAL>$00FFFB:$000A</VAL>
</VALUE3>
<VALUE4>
<VAL>$00FFFC:$00F8</VAL>
</VALUE4>
<VALUE5>
<VAL>$00FFFD:$0007</VAL>
</VALUE5>
</VALUE>
</DEVICE>
</MCU_DEVICE_FLAGS>


MPPPI:
[DEVICE]
Name=P18F86J60
Clock=41666667
[MEMORY_MODEL]
Value=0
[BUILD_TYPE]
Value=0
[ACTIVE_TAB]
Value=UDP_Bootload_V7_ZABBIX.mpas
[USE_EEPROM]
Value=0
[EEPROM_DEFINITION]
Value=
[FILES]
Count=1
File0=UDP_Bootload_V7_ZABBIX.mpas
[BINARIES]
Count=0
[IMAGES]
Count=0
ActiveImageIndex=-1
[OPENED_FILES]
Count=1
File0=UDP_Bootload_V7_ZABBIX.mpas
[EEPROM]
Count=0
[ACTIVE_COMMENTS_FILES]
Count=0
[OTHER_FILES]
Count=0
[SEARCH_PATH]
Count=3
Path0=C:\Program Files\Mikroelektronika\mikroPascal PRO for PIC\Defs\
Path1=C:\Program Files\Mikroelektronika\mikroPascal PRO for PIC\uses\P18\
Path2=C:\Documents and Settings\Admin87\Desktop\MikroPascal_PRO_PIC_Example\UDP_Bootloader_PIC\
[HEADER_PATH]
Count=0
[HEADERS]
Count=0
[PLDS]
Count=0
[Useses]
Count=0
[EXPANDED NODES]
Node1=Sources
Node2=Output Files
Count=2


Top
 Profile  
 
PostPosted: 09 Jul 2014 18:58 
Offline

Joined: 18 Jun 2008 11:43
Posts: 3764
Location: Nieuwpoort, Belgium
Edited 2014-07-22: Solved somehow: build my project with mP version 5.00, and after that it was comilable again with v6.40. I found no explanation...

------------------

yo2lio wrote:
I updated the libraries.

I made small changes in Ethernet libraries and it's strongly recommended to update this...

MP4.60 : http://www.microelemente.ro/MikroPascal ... y_V1_5.rar

MP5.00 : http://www.microelemente.ro/MikroPascal ... y_V1_6.rar
Hi Florin, I have some strange problems when I try to use v1_6 (which was for for mP5.00) together with mP v6.4.0. I get an error as shown below:

Quote:
...
diagnostics: 0 134 Compiled Successfully C:\PIC Projects PRO compiler\Projects\ETH File Server Fat32\ETH_File_Server_Fat32.mpas
diagnostics: 0 139 All files Compiled in 16 ms
error: 0 304 object file name [HTTP_Server.mcl] does not match source file name [] object file name [HTTP_Server.mcl] does not match source file name []
error: 0 453 Unsuccessful linking 'ETH_File_Server_Fat32.mpppi' Unsuccessful linking 'ETH_File_Server_Fat32.mpppi'

The .mcl filename above is not one of the ENC28J60 files, but is only present if I add "lib1_enc28j60_v3_5.mcl" or "lib1_enc28j60_v3_5.mcl" to a uses clause in one of my units. If I do not add those libs in my uses clauses I get some "not defined" errors (e.g. for "socket").

Would it be possible for you to generate a version of both .mcl files with the v6.4.0 mP compiler?

Thanks in advance! :D :D

_________________
Kind regards, Dany.
There is a crack in everything, that's how the light gets in... (L. Cohen)


Last edited by Dany on 22 Jul 2014 21:42, edited 1 time in total.

Top
 Profile  
 
PostPosted: 10 Jul 2014 08:58 
Offline

Joined: 28 Jun 2011 11:21
Posts: 156
Hi Yo2lio(Florin). I have still a version 3.4 of your Basic version of the stack and a Ver 3 of the Basic Bootloader. Is that still in tact or is the upgrade inline for a new MikroBasic version. I looked at the one you post and don't see what changes you made as i'm using your MikroBasic version.


Top
 Profile  
 
PostPosted: 10 Jul 2014 09:01 
Offline

Joined: 28 Jun 2011 11:21
Posts: 156
O i forgot. Can someone tell me if there is a WIFI Bootloader available. I'm using a WIFI PLUS Click board?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 90 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: