Jump to content

All Activity

This stream auto-updates     

  1. Last week
  2. The way I2C works when you add a second device no changes should be required in your configuration. If the working address stops working it is usually either because of multiple devices with the same address or it is due to an electrical problem. Could be the capacitive loading on the bus or even reflections if you have a star with long lines without termination (could also be incorrect size of or even missing pullup resistors). What I would suggest is to try and reduce the speed after ensuring that you have different addresses. Also look at the lines with an oscilloscope and check to see if the bus is being pulled down (ACK) after the address. If not no device is recognising the address.
  3. Earlier
  4. Im not sure which problem im having actually but I have one stm32 device as a master and i have two peripherals( 1 is OLED and then other is an Stm32 device(same product number)) and I am trying to get the master to recognize both peripheral addresses; however, when the OLED is only connected the address is found but when i also connect the stm32 device both address are not found and the debug keeps running.. im not sure if its an bus problems (#4 or #5) or is my initialization wrong even though I have followed the datasheet thoroughly and have set the address properly... hopefully anyone else has experienced this and figured out a way to fix this please let me know
  5. Evan, This sort of news sounds very pertinent to the members of this forum. Please show us your technology!
  6. Hi guys. This is Evan Venn - UK developer of Great Cow BASIC and PICKitPlus software. Question: What is the right etiquette for posting? I am asking before posting. 🙂 1. I can share release news, progress and updates on Great Cow BASIC. Great Cow BASIC is an open source compiler for Microchip 8-bit PICs & AVRs and Logic Green Technology PICs & AVRs. Is there interest in the news, progress and updates on Great Cow BASIC? 2. I can share release news, progress and updates on PICKitPlus. PICKitPlus is the software to support PICkit2 and PICkit3 programmers across Windows, PI, Mac and Linux. This is a low cost but commercial product - so, not free. Is there interest in the news, progress and updates on PICKitPlus? I would want to share as we are adding new capabilities almost every month and we have an ever grown user base.
  7. You have mis-interpreted the table, each row is meant to be independent. I thought the same thing, until I realized that the columns were not to be taken as a whole, but just defining low, medium, or high for each independent category column.
  8. I have also catalogued a number of typical I2C errors including typical addressing errors in this blog post
  9. Was any solution found? I note the CONFIG bits have not been shown. The chip will not run if the oscillator has not been set up correctly, and it will be rapidly resetting if the WDT has not been disabled.
  10. I've decoded your scope plot. The first one looks right, but note you get a NAK back, which simply means no device feels addressed to respond. The second one is shifted by one with an added 1, this doesn't seem to be right according to the datasheet. What about the A0 and A1 pins? Look here: The A0 and A1 pin will determine the address, the default case seems to be an internal pull up, so A0 and A1 are both 1, not 0. Might this be the problem why the chip doesn't react?
  11. Hello, I am trying to communicate with an MCP4441 chip using the I2C interface and using an Aardvark I2C cable from Total Phase. I am trying to read the registers which have non-zero default values (2,3,8,9), but always get back 0. It appears from the data sheet for the part that the control byte should be 0x59 is A1:A0 = 00 (see attached page from datasheet) I have attached scope captures of SCL and SDA when I tried setting the write and read address to 0x59 and 0x2c. Both of these attempts read back 0. Any ideas on what I am doing wrong? Thanks.
  12. I think the list will complete with books on networking protocols. TCP/IP Illustrated, Volume 1 by W. Richard Stevens I found this to be one of the best books to understand how Internet protocols work. I have read the first edition, have not read the second one. Companion book on Unix socket programming, I like the first edition which is very concise, but expects a lot of Unix background. Unix Network Programming, First Edition by W. Richard Stevens Or subsequent edition, if you want more explanation, equally good. Unix Network Programming, Volume 1
  13. Perhaps I can explain it better with an example. If you wrote code like this, which is using a non-compound literal int i = 7; where do you expect the 7 to be located in the map file? Of course the correct answer is that it gets encoded as part of the assignment code, so it would end up in the TEXT segment with the other code, but there is no rule for this, if this is an auto variable it will just be in the TEXT segment, if it was statically allocated though the compiler may, as an optimization, copy variables in bulk into the ram location of i, but I would say even in that case it goes in TEXT. The problem is not whether or not the literal is valid C or not, of course it is valid, but I think your expectations of where (or perhaps more accurately IF) memory is allocated for the struct are not quite right. I think if you look at the ASM generated for your initializer it will make more sense. In the Microchip PIC's I spent a lot of time on your initializer would compile to something like this MOVLW 2; MOVWF actualCat MOVLW 17; MOVWF actualCat+4 Now if you have code that takes the address of that, it will actually return the address of what? Perhaps the instruction MOVLW? This is dangerous because it will not necessarily behave the way that you expect. If you do a cast like you are doing, depending on the implementation in the compiler it may create a temporary variable on the stack, and then return the address of this temporary variable. This is also dangerous because although your allocation will work the pointer will not be valid later in the application, and even if you test it and the memory is still intact it may be deemed fair game to the compiler to hand out to someone else at the time, in that case it is dangerous as you are pointing to unallocated memory and will get undefined behavior (even in C++). Yes of course I am also using designated initializers in the examples in the article above, I agree that they work great (not only on small devices, on all devices), but of course you lose control of the memory allocation if you do it the way you are doing it (specifically casting the anonymous struct and then taking it's address) because if you start casting things you better know what you are doing because casting == telling the compiler you know better than the compiler - never a great idea 😉 I generally avoid designated initializers though since it was only added in C99 and many compilers from embedded vendors do not yet support them so I always run into portability problems when I do that.
  14. Hi Orunmila. Thank you for the quick reply. The initialization is using something called 'Compound Literals'. It's perfectly valid according to the GCC documentation, but beware, it can be 'dangerous' if you're using C++ (I'm not). Unfortunately, the GCC documentation does not seem to mention how to ensure the compound literals to be in a specific section. -But if anyone would know these things (apart from the compiler developers), it would be developers of embedded software like you. ;) Here's a link to an example, which you may find useful, because initializing this way is really beneficial on small devices: http://nickdesaulniers.github.io/blog/2013/07/25/designated-initialization-with-pointers-in-c/
  15. You are initializing the structure using an anonymous structure which is not specified to be located in a specific setion. I have not investigated it any further but I think it might actually be dangerous to take the pointer of an anonymous struct like that because I believe it will be allocated on the stack and it will not be obvious when the memory is being freed (although I may be mistaken here, it still looks dangerous to me). I think what you should do is something like this #define BOB_SECTION __attribute__((section(".bob"))) #define FRANK_SECTION __attribute__((section(".frank"))) struct Cat { uint16_t heads; uint16_t tails; }; FRANK_SECTION struct Cat actualCat = { .heads = 2, .tails = 17 }; BOB_SECTION struct Cat* gNeelix = &actualCat;
  16. I have a pointer to a structure and would like to initialize this to point to a structure. The pointer itself should reside in one section, while the structure's data should reside in a different section. The following example puts the pointer in section '.bob', but how do I ensure the structure data is inside section '.frank' ? #define BOB_SECTION __attribute__((section(".bob"))) #define FRANK_SECTION __attribute__((section(".frank"))) struct Cat { uint16_t heads; uint16_t tails; }; BOB_SECTION struct Cat *gNeelix = &((struct Cat){ .heads = 2, .tails = 17 }); -I've tried placing FRANK_SECTION in every place I could think of on the right hand side of the assignment, but I have not succeeded finding a way to get this to happen. What I'm trying to accomplish would be something like the following, but as a pure initializer: FRANK_SECTION static struct Cat sNeelix = { .heads = 2, .tails = 17 }; BOB_SECTION struct Cat *gNeelix = &sNeelix; Am I so lucky that you have any pointers ? :)
  17. This really is a nice little program to confirm operation of the xpress board! I forgot to check the stdio redirect option in for the eusart module in MCC and so was stuck for a couple minutes! One question is with regard to how the uC is programmed. Does the program go into ram on the xpress board? I have not looked in depth yet, but the program seems to go away when the board restarts. Keith
  18. I followed your instructions step by step. Finally, downloaded SimulatorUART.zip to run. You say "If you run this code in the simulator it will open an additional output window which will show the output from the UART as follows", but my screen doesn't prompt out "UART 1 output" window. So I still cannot see printf() result. My MPLAB X IDE version is 5.35, XC8 is 2.20. And I don't install CCS C Compiler in MPLAB X IDE plugin. Could you help me to figure out my problem. Thank you!
  19. I would also suggest you take a look at this because you seem to be writing to the port register bits which will cause read/modify/write errors. Is it possible that the pin is actually toggling really fast?
  20. Hi! I'm not sure that's happening, maybe we can find this together. First, check out this thread about PORT and LAT: If you like to set an output, use LAT registers instead of PORT. Second thing is your code: Is it your intention that variable c is going negative? if (PORTAbits.RA1 == 0) { if (c1_m1 == 1) { c--; c1_m1 = 0; } } You used an "int" type, which means c is a signed 16 bit integer. You could use more explicit types like "int16_t" and check if your code regards the negative case properly. Third thing I noticed: Your while() loop is running with maximum speed. It may be better to have a timing in your main sequence to get a more predictable runtime. For example, just add Timer0 to your main loop: // configure TMR0 according to datasheet, section 20.2 OPTION_REG = 0b11010011; while(1) { // wait here for next cycle while(INTCONbits.TMR0IF == 0); INTCONbits.TMR0IF = 0; // execute cyclic code // ... } About your floating output: How did you measure this? If you have used a multimeter, you likely are measuring the RMS value of a rapidly changing digital output. The TMR0 helps you getting a deterministic behavior, a scope helps you seeing what is really going on... And did you halt the code at certain points and observed the behavior of your pins? With a PICKit or any other debugger attached to your controller, just run a debug session and set a breakpoint where you expect bad things to happen 🙂
  21. Hey guys, I am developing a project with the PIC16F1826 and one of my outputs is flotoating like 1.9V, 2.9V and I can´t find why. I already check the ANSEL registers and initialize the PORTs at 0. It start´s when I add more if statements in my checkmodule() function... Here is the code: int c=0; int c1_m1 = 0; int c1_m2 = 0; int c1_m3 = 0; void main(){ OSCCON = 0b01110000; ANSELA = 0b00000000; ANSELB = 0b00000000; TRISA=0b11111111; PORTA = 0b00000000; TRISB=0b00000000; PORTB = 0b00000000; while(1){ checkmodules(); module_status(); } } void checkmodules(){ if(PORTAbits.RA1==1){ if(c1_m1==0){ c++; c1_m1=1; } } if(PORTAbits.RA1 == 0){ if(c1_m1 == 1){ c--; c1_m1 = 0; } } // When I add mores of this if´s, I start to have the problem with my PORTB outputs... } // end checkmodules() void module_status(){ if(c>0 && c<=3){ PORTBbits.RB4 = 1; } if(c==0){ PORTBbits.RB4 = 0; } if(c>=3){ PORTBbits.RB5 = 1; } if(c<3){ PORTBbits.RB5 = 0; } }// end module_status()
  22. Please check VDD voltage, this dsPIC needs at least 4.5V to do a bulk erase. If it's lower, erasing step will fail.
  23. When that happens it usually indicates something wrong with the connection to the device. The strengths of the pin drivers are not the same on the different programmers. Perhaps you have marginal amounts of capacitance on the lines?
  24. I am trying to program dspic30f with pickit4 and using MPLAB X IDE 5.40, on programming it shows Erasing...Verify failed. [config mem] 0x2007, expected 0x1ff, got 0x44Programming did not complete. but it's ok if i use pickit2 to programing
  1. Load more activity

  • Popular Contributors

    Nobody has received reputation this week.

  • Who's Online (See full list)

    There are no registered users currently online

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...