0
\$\begingroup\$

I am working on a project which involves using an Arduino alongside several PSOC-049-42xxx chips.

I want to be able to update the firmware on the PSOCs just by updating the hex file on the Arduino and having it push a new hex file to each PSOC.

I've been reading through this but It hasn't really helped me much. Perhaps someone here could give me some pointers? http://www.cypress.com/file/137036/download

DropBox Link to arduino project << So far I have the API functions provided by Cypress and my understanding is that I need to produce the communication layer functions?

I seem to get a LOT of errors with these API functions however, and I really am not too sure how to port them. Help would be GREATLY appreciated.

As it stands I've got a bootloader project prepared for the PSOC, with I2C enabled and a method for allowing the device to get its own address by reading three bits from external pins. I've got an active I2C bus which I know is working as I've been using it to ping bytes back and forth for other projects. Where I'm stuck is implementing a bootloader host within the Arduino which will parse a hex or cyacd file which is uploaded to the Arduino at programming time, and pass it to each PSOC in turn over I2C.

I'm currently trying to massage these API functions to just stop getting them to throw a tonne of errors before I can even think about how to handle the communications

\$\endgroup\$
  • \$\begingroup\$ I struggle to understand whether your problem is more about Arduino or about remote programming. Perhaps you could add all the details of what you're trying to achieve and what you actually tried. \$\endgroup\$ – clabacchio Feb 23 '18 at 14:10
  • \$\begingroup\$ Is that a bit clearer? \$\endgroup\$ – GigaJoules Feb 23 '18 at 14:32
  • \$\begingroup\$ Am I understanding correctly that the I2C bootloader is built into these PSOCs and it's "just" a matter of sending the hex file via the I2C port? You already have the bootloader working using some external programmer? I'm really not [clearly] understanding at all what you have so far achieved. If I understand correctly, you want the hex file to be in the Arduino and that programs the PSOC? I'm not clear where the APIs come in. (And no, I have not ploughed through the datasheet!) \$\endgroup\$ – DiBosco Feb 23 '18 at 17:26
3
\$\begingroup\$

Looking at the complexity involved, I would not continue with your plan as it is now i.e. to go from "nothing" straight to "Arduino as PSOC I2C Bootloader Host". That's because, as you are finding, your application note assumes your PSOC Bootloader Host is another PSOC.

I have been in (and seen other people in) similar situations a few times i.e. documentation on how to do X assumes hardware A and toolchain B, but your project uses hardware C and toolchain D. Since you already have items C & D, you think you'll save time and money going straight to C & D and avoiding A & B (which are the ones described in the documentation).

However, without being able to use much of the documentation, it can be a much bigger struggle going straight to C & D than it appears at first. Instead, the seemingly "longer" route of getting A & B (as documented and known to work) setup first, and then migrating to C & D (your target final configuration) can be much quicker in the end.

Therefore, from experience, I recommend an approach like this:

  • Follow the application note, buy the recommended PSOC kits (for bootloader Host and Target) as described in that documentation, so that you can follow the documentation exactly.

  • Get that to work. If you have any problems, then you can ask questions to the manufacturer's normal support channels & forums etc., since you are following their application note exactly at this stage.

  • Use a logic analyser to record, review and understand the I2C data transfers which are used during that successful bootloader process.

  • Only after doing that, then you start to port the bootloader Host code onto the Arduino. You now have the advantage of having a known-working bootloader Target device and recordings of the correct I2C data transfers from using a PSOC bootloader Host, which your Arduino bootloader Host code must match. If you have problems, you can compare exact behaviour between the PSOC bootloader Host (which you got working first, as explained above) and the Arduino bootloader Host.

\$\endgroup\$
  • \$\begingroup\$ Yeah, at this point I'm thinking I'll just include another PSOC in the design since they're only £3, and have it's sole purpose be to update the other PSOCs. Sadly this means that the user will have to update 2 different devices in 2 Different ways but it's got to be better than nothing! Of course if anyone comes up with any way I can proceed down this route I'd still very much like to hear it! I've seen a couple of people n the cypress forums discussing having implemented this but they do not disclose their code or which microcontroller they used (Rolls eyes) \$\endgroup\$ – GigaJoules Feb 23 '18 at 16:32
  • \$\begingroup\$ @GigaJoules - Hi, "I'll just include another PSOC" Of course you could do that (i.e. follow the app note exactly) but you could do as I suggested and consider that as a "stepping stone" to using an Arduino bootloader Host. It's just that you probably do need that stepping stone IMHO. "if anyone comes up with any way I can proceed down this route" Unfortunately in its current form, your question is likely "too broad" as you don't give code examples, examples of the I2C bus behaviour (good & bad), and examples of the errors. In fact, just one error is enough for a question here. Good luck! \$\endgroup\$ – SamGibson Feb 23 '18 at 16:41
  • \$\begingroup\$ Well the I2C Bus has just been used to send packets of a few bytes back and forth to confirm that certain things were working, and to show that my communication functions (Which should be scaleable in terms of the number of bytes sent) were correct. I could get the PSOC working as an ISP in just a few steps and am confident that it will work (unfortunately all my breadboards are full and I can't afford more right now, nor can I risk pulling them apart, so I cant test it just yet). My issue is that I cant even get the rest of the functions given by cypress to stop screaming ERROR ERROR! \$\endgroup\$ – GigaJoules Feb 23 '18 at 17:07
  • \$\begingroup\$ I can't provide the I2C behaviour because I have nothing relevant to give yet, but I can provide a ZIP of my test arduino project as it stands and you'll see what I mean if you try to verify! (Its in the OP now) \$\endgroup\$ – GigaJoules Feb 23 '18 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.