Jump to content

tom 2007

EstablishedMember
  • Content Count

    57
  • Joined

  • Last visited

Posts posted by tom 2007


  1. Already tried that yesterday through build->clean and didn't solve the problem but today I deleted the files from the "Release" folder manually, then I did a recompile and it worked!

    Some source code files are in a sub directory in my project dir and it seems the IDE doesn't remove the .obj files for the .c that are in the subdirectory when you do build -> clean.

    Thanks for the help

    Tom


  2. Hi,

    I have installed Sourceboost 7.42 and ran preg.exe as administrator, entered my name and license key, clicked OK and it says:

    Quote

     

    boostc_pic16.exe: success
    boostc_pic18.exe: success


     


    However when I click the build button in the IDE the linker always complains:
     

    Quote

     

    License restricted by the following files:
        Release/pic_usb.obj
        Release/pic_usb_buffer_mgt.obj
        Release/usb_config_hid.obj
        Release/usb_hid_class.obj
    Recompile the code with a less restrictive compiler license!
    License exceeded by RAM: 880 bytes
    License exceeded by ROM: 2448 bytes

    You have reached the limit of the Lite License (Unregistered)
    PIC18 max code size:8192 bytes, max RAM banks:2, Non commercial use only
    You can upgrade your license. Please visit: http://www.sourceboost.com

     

    What can be wrong?

    OS is Windows 10 64bit


  3. Yes I've noticed some of those things too. It took a while before I found the problem was in the compiler and not my code :D In the assembler it looks like this:

     

    SETF main_1_test

    MOVLW 0x20

    MOVWF main_1_test+D'1'

    SETF main_1_test2 ;0x20FF = 8447 is loaded into test directly

    MOVLW 0x3F

    MOVWF main_1_test2+D'1'

    MOVF main_1_test2, W

    CPFSEQ main_1_test

    BRA label1

    MOVF main_1_test2+D'1', W

    CPFSEQ main_1_test+D'1'


  4. Hello,

     

    Today I noticed some (what I think) strange behavior of the | operator:

    #define TEST_1 1
    #define TEST_2 2
    #define TEST_4 4
    #define TEST_8 8
    #define TEST_16 16
    #define TEST_32 32
    #define TEST_64 64
    #define TEST_128 128
    #define TEST_256 256
    #define TEST_512 512
    #define TEST_1024 1024
    #define TEST_2048 2048
    #define TEST_4096 4096
    #define TEST_8192 8192
    
    
    void main(){
    	unsigned int test;
    	unsigned int test2;
    	
    	test = TEST_1 | TEST_2 | TEST_4 | TEST_8 | TEST_16 | TEST_32 | TEST_64 | TEST_128 | TEST_256 | TEST_512 | TEST_1024 | TEST_2048 | TEST_4096 | TEST_8192;
    	test2 = TEST_1 + TEST_2 + TEST_4 + TEST_8 + TEST_16 + TEST_32 + TEST_64 + TEST_128 + TEST_256 + TEST_512 + TEST_1024 + TEST_2048 + TEST_4096 + TEST_8192;
    	
    	//test = 8447
    	//test2 = 16383
    	if (test == test2){ 
    		//...
    		
    	}
    }
    

    when splitting the test = TEST1 ... line to:

    	test = TEST_1 | TEST_2 | TEST_4 | TEST_8 | TEST_16 | TEST_32;
    	test = test | TEST_64 | TEST_128 | TEST_256 | TEST_512;
    	test = test | TEST_1024 | TEST_2048 | TEST_4096 | TEST_8192;
    	
    

    then test becomes equal to 16383 ...

     

    Compiler: boostc 7.12 (same problem under 7.10)

     


  5. I've placed the postbuild.bat in the project directory but after linking i get:

     

    Failed to spawn (C:\Users\Tom\Documents\pic\ethernet board\postbuild.bat). Check if path to this external application is correct. (Error code 2)


  6. Is there a way to turn off the generation of the .tree file?

    I have a large project and the .tree file is +/- 800MB in size and this takes about 10min. to refresh in the IDE after a build :(.

     

    I don't use the call tree window that much so it would save a lot of time if there was a way to tell to the linker not to generate this file.

     

     

    Tom


  7. network_in_configmode() is a function that will check if an IP address was received from the DHCP server. Please connect your ENC28J60 to your router with an ethernet cable. If everything is configured properly your PIC should be able to get an IP address from the router (unless there is still something else wrong).

    If you don't know what DHCP,... is it's probably time you start to learn how TCP, UDP, IP, DHCP, HTTP, DNS,... work.

    http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol


  8. I think it could be a problem with your code in your interrupt routine. Can you check whats inside void interrupt(){}? Maybe the pic is stuck in this (try adding code that makes a led blink when it enters the interrupt). The rtc.c will enable the interrupt from some timer that is used for remembering the time.

     

    Did you try putting rcsta1.CREN=0 ? To disable the receiver.

     

    Another option is to start a new project with ONLY the sp.h/sp.c and try messing with that.

     

    If the len parameter is bigger than the size of the buffer it will continue to read from the buffer. It will end up somewhere in the ram memory where stuff from other variables is stored that's why it says ory.


  9. What happens when you use the serial_send_data(unsigned char * data, unsigned char len) function:

    serial_send_data("SPI & SRAM INIT OK, Performing memory test\r\n",44

    ) //where 44 is the number of characters in the string. Check if this will block the pic (if it does it must be a problem with the while (txsta.TRMT==0); or the "for loop" inside the serial_send_data() function).


  10. I think the configuration is correct. Does the PIC continue doing other stuff after writing "SPI & SRAM INIT OK, Performing memory" or is it stuck?

     

    1040 gives a baud rate of 9606,14 this is close to 9600 but not exact. Maybe the string is too long and things go out of sync (not sure)? Try writing a long string in the beginning of your program and see if that works. Do you get other characters where the "test" is supposed to be printed or just nothing?


  11. In config.h go to:

    // - - - - - - - - - - - - - - - - - - - -

    // serial ram configurations

    // - - - - - - - - - - - - - - - - - - - -

    #define sram_no_hold_pin //hold pin of 23K256 is attached to +3.3V

    #define sram_tris_cs trisd.4

    #define sram_tris_hold //(not used)

    #define sram_cs portd.1=1;portd.4 //chip select (portd1.=1 makes sure the enc28j60 cs is high because only 1 device at the SPI bus can be selected at the same time)

    #define sram_hold //hold active low (not used)

     

    in stackconf.h go to:

    //Configure ENC28J60

    //Use ENC28J60 module

    #define ETH_ENC28J60

    #define enc_tris_cs trisd.1 //chip select

    #define enc_tris_rs trisa.2 //reset device

    #define enc_rs porta.2 //reset the device, attach porta.2 to the ENC28J60 reset pin

    #define enc_cs portd.4=1;portd.1 //chip select (sets the sram cs=portd.4 to 1 and the enc28j60 cs at portd.1 to 1 or 0 depending on where it's used in the code)

     

     

    If it doesn't work make sure the spi functions in spi.c are working (use an oscilloscope to see if any data is coming out of the SDO and SCK pins)


  12. t3con.TMR3CS1 is for selecting the clock source. In your case I see there is only 1 clock select option: t3con.TMR3CS=0 for internal clock select.

     

    I think this may work better in your case (please check):

    #define RTC_INIT_TIMER pie2.TMR3IE=1; t3con.T3CKPS1=1; t3con.T3CKPS0=1; t3con.TMR3CS=0; t3con.RD16=1;

     

    Also adjust these values according to your clock frequency:

    #define RTC_CLOCK 48000000 //CPU clock freq fosc

    #define RTC_TICKS_PER_SECOND 1500000 //timer count frequency =(fosc / 4) / 8 (timer prescaler)


  13. 1) rpinr21 is something special for the PIC18F27J53. If you use another PIC you'll need to adjust this:

    in the config.h you change the "#define spi_port2_conf " to something suitable for your application. Actually you just need to make sure the spi_init() functions initialize the SPI module of your PIC (you can change the function so it works with your PIC).

     

    2) you don't need the RTCC peripheral (the rtc.c code doesn't use it). I've used timer timer 3 for generating a second and tick counter on the PIC. The rtc.c file holds a variable that tells the ammount of seconds passed since reboot (or since 1970) and a variable that holds the total number of clock cycles since reboot. I guess your PIC doesn't have a timer #3 so you'll have to use another one. It's important for TCP.c and some other stack functions to calculate timeouts.

    rtc_get_time() //must return number of seconds since reboot (or since 1970 if you are able to sync it in some way).

    rtc_get_tick() //number of clock ticks since reboot

    rtc_get_tick_div256() //same as above but devided by 256

    rtc_get_tick_64k() //same as rtc_get_tick() but devided by 0x1000

     

    3) you can remove the ADC/comparator related stuff for my application it was needed to turn it off in order to make some pins of the chip to work as input or output (check datasheet).


  14. Yes that's possible. It was written like that because in the 7.05 version I got the error "variable 'j' already declared" that's why I removed the declaration in the second loop.

     

    So to Dra:

    At line 283 change the code:

    for (unsigned char j=0;j<250;j++) SomeData[j]=j;
    sram_write(0,SomeData,250); //write data
    for (unsigned char j=0;j<250;j++) SomeData[j]=0;
    sram_read(0,SomeData,250);
    for (unsigned char j=0;j<250;j++){
     if (SomeData[j]!=j){
      serial_send_string("Error address: ");
      serial_send_hex(j);
      serial_send_string("\r\n");
     }
    }
    

     

    Also you will need to add a serial RAM (23K256) if you want to use TCP connections. The EEPROM can be used for storing settings like the IP address and firmware updates.


  15. To implement to an existing project:

     

    First make sure your PIC has enough ROM because the project can get really BIG (50K or more). I've used the PIC18F27J53 because it has 128KB ROM, runs at 48MHz and is available in SMD & DIL package.

     

    Then download & extract the files from the example.

    -Add the files in the 'stack' folder to your project.

    -add stackconf.h to your project.

    -Take a look at the schematic (pdf file).

     

    Normaly you only need to change the stackconf.h file to make everything work with your project.

    Here you need to define some settings for things like the chip select of the ENC28J60, SPI read/write functions, how the TCP stack code can access external SRAM, ram size, ...

     

    Any more questions please ask.

×
×
  • Create New...