easyIPC Format

Message Header

This is the new message format that I will use on SPI, RS485 and Ethernet. For CAN I am not sure yet. I might want to take more advantage of the strong capabilities in CAN, but lets see.

The format above allows me to communicate device to device in a network, but at the same time also allow for streams of information that is not device depending. A device number is local for the network, meaning that all 1:1 messages on the link etc uses this format. Right now I want to establish a RS485 protocol that can support CLI as well as more advanced schemes. Next I want to bring up SPI and later CAN. But, I also want to add Modbus and CANopen support later – loads of fun.

Using a per Message CRC on Ethernet is not needed, but it allows me to maintain end to end Message integrity.

RS485 is in this case running 2Mbps, so I want top-side to send a Start TDM signal with a list of devices that will respond. Device 0, Device1 etc. The logic is simple – Device 0 is always Network Master starting the loop by sending a list of devices that need to respond. At the end of it’s own sequence it sends EOT and device 1 starts within 4 ms etc.

I have 3 XPortHub devices I can add into the network for testing so we can get this off the ground.

TDM Sequence

This illustrate the TDM scheme between 2 nodes in a Network. Start TDM is only sent from device=0.

Start TDM

The content of Start TDM is a list of devices that will respond and in what order. Each device have a time-slot of 4ms to respond before the next takes over. Devices not on the list will be silent.

End of TS

End of TS (Time-Slot) is the last message send by all devices. This is broadcast and gives the next device a 4ms window to start sending it’s Messages. This scheme is used on RS485 and SPI. RS232 and Ethernet are full duplex and I want to evaluate options for CAN a bit later.

Baudrates

Baudrates like 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 230400, 460800, 921600 are rather standard, but what do you use to set 10Mbps?

Testing with a Windows PC I manage to get 2Mbps as shown here, but Windows is not able to open higher frequencies. I am in this case using USART6 on STM32F405 capable of 10Mbps speed, so it’s Windows that is the limitation.

XPortHub changes

I have not tested everything yet, but rev 1.1 of XPortHub need a few changes:

  • correct package on serial flash.
  • wap sequence on dip switch.
  • replace battery with a proper battery holder. Can be mounted on back-side if needed. This also fix the short-cut here.
  • Test Power Connector. I have a 2-pin connector that is right-angle and fit well. That should be ok as is.
  • Add Led’s if possible. I have a few spare pins and it would be nice with some more led’s.

These are just minor adjustments as the board seems to work fine!

PCB Shortcut

This was a rare bug on the XPortHub! I have not bothered to test the super-cap/battery for the VBAT much, but suddenly realized as I was doing other changes that I had an error message related to this. And correct – measuring the PCB I have a self infected short-cut. CNC machinery making PCB’s require a minimum of 0.14mm distance between lanes to guarantee that lanes are not shorted and this is shorted by accident.

The EDA warns me, so this is me overlooking the error message. I have a package overlap here because I have an alternative connector – this generate error messages I have to overlook and I obviously overlooked one I should not have overlooked. It’s no big deal because this could very well have been connected. The only component I shortcut is a diode that should prevent leakage back to other circuitry. But, it means the battery will power the entire circuit, not just VBAT.

I keep repeating myself – I always need a minimum of 2 PCB layout’s. The more I push to work faster the more of these minor bugs I am guaranteed – but, that is ok – I just plan for it.In this case I want to add a proper battery holder on 1.1 anyway.

FAT FS Middleware

FATFS is a middleware component you can add to create a MicroSD API with full file I/O support. It only takes a few clicks with CubeMX and you have an API with the following and more:

  • f_mount(): Register/Unregister a work area
  • f_open(): Open/Create a file
  • f_close(): Close a file
  • f_read(): Read a file
  • f_write(): Write a file
  • f_lseek(): Move read/write pointer, Expand a file size
  • f_truncate(): Truncate a file size
  • f_sync(): Flush cached data
  • f_opendir(): Open a directory
  • f_readdir(): Read a directory item
  • f_getfree(): Get free clusters
  • f_stat(): Check if the object is exist and get status
  • f_mkdir(): Create a directory
  • f_unlink(): Remove a file or directory
  • f_chmod(): Change an attribute
  • f_utime(): Change timestamp
  • f_rename(): Rename/Move a file or directory
  • f_chdir(): Change the current directory
  • f_chdrive(): Change the current drive
  • f_getcwd(): Retrieve the current directory
  • f_getlabel(): Get volume label
  • f_setlabel(): Set volume label
  • f_forward(): Forward file data to the stream directly
  • f_mkfs(): Create a file system on the drive
  • f_fdisk(): Devide a physical drive
  • f_gets(): Read a string
  • f_putc(): Write a character
  • f_puts(): Write a string
  • f_printf(): Write a formatted string
  • f_tell(): Get the current read/write pointer
  • f_eof(): Test for end-of-file on a file
  • f_size(): Get the size of a file
  • f_error(): Test for an error on a file
  • disk_initialize(): Initializes the physical  disk drive
  • disk_status(): Returns the selected physical drive status
  • disk_read(): Reads sector(s) from the disk
  • disk_write(): Writes sector(s) to the disk
  • disk_ioctl(): Controls device-specified features
  • get_fattime(): Returns the current time

XPortHub Update

I finally managed to sort out the CubeMX/SW4STM32 error so I can move on a bit. The XPortHub (pictured above) is coming together very well. Sadly I have to upgrade this due to the Flash footprint error, so I will make some other adjustments as well.

CubeMX auto-generate all drivers with pin-setting, FreeRTOS, USB driver and even the FATFS system allowing the Micro SD Card to be used as a disk.

The pin-out above shows how dense this design is getting with only 5 spare pins. Using the USB as a serial link with a little console app this basically have more content than my first IBM PC back in 1983. It bring back some nostalgic reflections to my early days fiddling with DOS and C compilers.

What I will do next is actually to create a terminal application and a CLI with a Utility package that in many ways with mimic the old DOS/Console days.

CubeMX Strikes Again

I would like to simplify all Java applications, so I suggest I create my own Java 3 VM. It will only need one instruction:

CRASH

I had a project for XPortHub in CubeMX that worked well, upgraded CubeMX and shit hit the fan. Obviously the new CubeMX generate or don’t generate some script that SW4STM32 don’t like. I like CubeMX, but I am not impressed with ST Microelectronics complete lack of SW quality! I will get around this, but it is a major time-waster!

Cold Soldering

Soldering 0.5 pitch components is a challenge to get right. My latest problem have been cold soldering. Meaning that pins look ok, but as I test them I have no connection. Not sure if this is lack of temperature, lack of solder tin or what, but I will have to find a more reliable way because it has caused a lot of issues lately.

The illustration above shows the problem. Pins look as if they are soldered, but in fact they are not. I suspect a combination of to little paste and to low temperatures, but lets see.

Having MCU’s you don’t trust don’t help, but just for the record the one I tested did work!

New MCU’s

It is rare that I receive chips from China as unprofessional as these, but it does happen. I have no idea if these works at all yet, but we will see. If not the seller will loose out. I actually mounted a XPortHub, so we will see – but, this is why I want to build the test-bench with sockets.

Wrong Footprint

   This is the XPortHub mounted on top of a Rapsberry PI A+. The only lacking components are the SuperCap + the Serial Flash. I made the package for W25Q16 myself so I have no-one else to blame, but I have used a standard SO8 rather than the wider SO-8 footprint that I needed – bummer. Well, rev 1.1 coming up I guess.All in all I am quite happy with this Board.