-2

i have a bit of a tricky question. My case is this: I have to handle a large amount of PCB (up to 20) with some hardware and a PIC24FJ128GA306 the microchip only comes with a bootloader, and i want to upload my configuration to all of them either sequentially or at the same time. they are all to be connected to the same computer at the same time. My question is, is it possible to either send out to multiple com port at the same time, or to do an automated process which changes on some condition?

Claudi
  • 125
  • 1
  • 1
  • 9
  • It depends on the boot-loader. First of all, is it RS-232 or something else? Second, do the programmed devices ack the programmed frames somehow, either with a software command or hardware handshaking? You have to provide more details. – Lundin Jun 21 '16 at 11:41
  • Overall though, it seems more complex to build the cable needed to connect 20 devices to some DB9 RS-232 line, than to program each device one by one... Is this something you plan to do just once or on regular basis (production)? – Lundin Jun 21 '16 at 11:42
  • It is meant to be a test bench for random sample testing in production. a ficture is built to hold all 20 devices. – Claudi Jun 21 '16 at 11:51
  • TTL is used as far as i know, and im actually not sure if there is a handshake. – Claudi Jun 21 '16 at 11:57
  • What do you mean "TTL"? Is this some Microchip home-brewed interface? – Lundin Jun 21 '16 at 11:58
  • in my understanding RS-232 speaks to how the high and lows are transmitted in terms of voltage, in this case TTL (transistor-transitor logic) which is in same voltage range as USB – Claudi Jun 21 '16 at 12:04
  • TTL is the output from eg. uarts. The TTL can be converted to eg RS232 via hw like MAX232 – Illishar Jun 21 '16 at 12:05
  • yes but i was wondering whether it was possible to keep the TTL and use USB hubs or similar to connect multiple devices to the same pc, and then connect to these devices, either by using multiple programs (e.g tiny bootloader) or by using one program which is able to contril all the connections. – Claudi Jun 21 '16 at 12:08
  • You can. There're many hw solutions for just that. FTDI comes to mind. – Illishar Jun 21 '16 at 12:09
  • yeah, but thats only part of the solution. how do i then control 20 devices connected through USB to 1 PC – Claudi Jun 21 '16 at 12:12
  • As I said in the answer below. It'd be more simple with RS485 + Modbus. But perhaps that's just me. If you use usb (eg FTDI) you'd get 20 com ports on the PC. 1 device will be at the end of each com port. You'd still have to implement a communication (protocol) on both sides. – Illishar Jun 21 '16 at 12:15
  • okay i will look into that, thx for the patience. and sorry for the poorly formatted question, bu i had so many uncertainties. you helped med narrow down my search. – Claudi Jun 21 '16 at 12:19
  • This is just getting muddier and muddier... I would suggest starting by reading up about the basics, you can't get this working if you don't even know basic electronics. "TTL" only refers to signal voltage levels, typically 5V. It does not specify the communication interface. UART does. UART has "TTL" voltage levels. RS-232 has it's own, peculiar voltage levels (> -3V/3V). "COM port" refers to RS-232, not UART. Now what do you have and what do you want? – Lundin Jun 21 '16 at 12:36
  • the output from the hardware is TTL, i want to connect 20 of these to 1 pc and be able to upload a configuration file to all of them. my question is both how/if i format the signal before connecting to the PC, and how i control the 20 different connections from the PC. – Claudi Jun 21 '16 at 12:54
  • @Claudi Like speaking to a wall. I rest my case. Hire some professionals for this. – Lundin Jun 21 '16 at 13:03
  • Why even bother answering when the only object of you comment is to be condescending? if you cant help me then dont answer. no point in just stating that i cant be helped. – Claudi Jun 21 '16 at 13:14
  • Buy 20 of these: http://www.ftdichip.com/Products/Cables/RPi.htm. Plug it into your PIC24 and your PC. Start up your PC compiler + your MPLAB compiler. Write some code in each end that will send and receive your configuration. Flash the PIC24 fw. WIN – Illishar Jun 21 '16 at 13:14
  • @Illishar, this part i get, and these are considere as an option, just cant seem to fin any info on how the pc will handle 20 USB connections. on how to write out on all the different ports without doing it manually. – Claudi Jun 21 '16 at 13:17
  • The PC will see the 20 usb as 20 com ports. Com ports can be enumerated in eg. the SerialPort class from .NET. (Eg. this will give you a list of all com ports.) Open each com port, write out your data. WIN. (Yes, you might also open a wrong com port. There're ways around this. But it's prolly not important.) – Illishar Jun 21 '16 at 13:21
  • If by "manually", you mean that you have to write some code, then yes, it's a bit low tech. – Illishar Jun 21 '16 at 13:22
  • I got the answers i needed, thanks – Claudi Jun 21 '16 at 13:27

2 Answers2

0

The most simple hw solution for "multiple com port at the same time" would be RS485. It's almost as simple as RS232 both hw and sw wise. (You'd need an RS485 cable for the PC though.)

As for communication. If you want to make it nice, you'd implement a standard protocol. An obvious choice would be Modbus, due to the simplicity. If you want it even nicer, there is BACnet MSTP.

If you don't want to bother with protocol documentations, just make something like this:

<address><package length><package type><crc><data>

(That's almost Modbus.)

Illishar
  • 886
  • 1
  • 11
  • 24
  • You are assuming that the communication is done over something UART-based to begin with, which isn't clear. – Lundin Jun 21 '16 at 11:59
  • "com port" usually refers to uarts/ttl – Illishar Jun 21 '16 at 12:00
  • No, it usually refers to RS-232, which has nothing to do with "TTL" voltage levels. – Lundin Jun 21 '16 at 12:38
  • Actually, it refers to the win32 userspace interface often associated with RS232. These days though, you're more likely to encounter an usb device on the other side of the com port. However, the PIC24 doesn't come with builtin RS232. Only uarts and ttl. Solutions like RS232, RS485, FTDI usb all ends up as uart/ttl. Mostly. And they're all represented as "com ports" on windows. – Illishar Jun 21 '16 at 12:55
  • The OP has yet to explain what interface the microcontroller needs. All we know is that his computer has com ports; that is not useful information. If it needs UART then he must clarify what UART signals that are used, and what communication protocol there is. This whole "guessing competition" is a huge waste of everyone's time. – Lundin Jun 21 '16 at 13:02
0

There have been a case where I uploaded the firmware in 64 boards simultaneously using CAN on PIC24, however I had to do the boot loader myself as well as the software sending the data.

For your case, if you are in TTL UART (5V), you may want to give a shot to just connect the TX pin of your transceiver to the RX of all your boards and do not connect the TX of the boards, or perhaps only one board.

If you are lucky enough and your line doesn't have too much impedance it might work, though this is quite a dirty hack and shall only be used for dev. If the impedence is too high (you can check with an oscilloscope) you may try to add a driver on the line.

The best as stated would be to use some compliant bus like CAN which worked pretty well in my case, most of the pic24 have CAN hardware controller.

Damien
  • 1,492
  • 10
  • 32